
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>GeometryType · PostGIS中文指南</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="xxx">
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-pageview-count/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-prism/prism-okaidia.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-emphasize/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search-pro/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-folding-chapters/folding-chapters.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="Accessors.html" />
    
    

    <script src="../gitbook/gitbook-plugin-graph/d3.min.js"></script>
    <script src="../gitbook/gitbook-plugin-graph/function-plot.js"></script>    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        <li class="header">第 Ⅰ 部分：PostGIS基础</li>
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" >
            
                <span>
            
                    
                    一 初识PostGIS
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../introduction/PostgisAbility.html">
            
                <a href="../introduction/PostgisAbility.html">
            
                    
                    1.1 PostGIS特性
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../introduction/PostgisAbility.html">
            
                <a href="../introduction/PostgisAbility.html">
            
                    
                    1.2 PostGIS使用场景
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.2.1" data-path="../installation/PostgreSQL Installation.html">
            
                <a href="../installation/PostgreSQL Installation.html">
            
                    
                    1.2.1 适用场景
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2.2" data-path="../installation/PostGIS Installation.html">
            
                <a href="../installation/PostGIS Installation.html">
            
                    
                    1.2.2 不适用场景
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../introduction/PostgisAbility.html">
            
                <a href="../introduction/PostgisAbility.html">
            
                    
                    1.3 PostGIS使用建议
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" >
            
                <span>
            
                    
                    1.4 PostGIS安装
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.4.1" data-path="../installation/PostgreSQL Installation.html">
            
                <a href="../installation/PostgreSQL Installation.html">
            
                    
                    1.4.1 PostgreSQL安装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4.2" data-path="../installation/PostGIS Installation.html">
            
                <a href="../installation/PostGIS Installation.html">
            
                    
                    1.4.2 PostGIS安装
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="../introduction/ReleaseNotes.html">
            
                <a href="../introduction/ReleaseNotes.html">
            
                    
                    1.5 PostGIS重大版本
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" >
            
                <span>
            
                    
                    二 PostGIS入门
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" >
            
                <span>
            
                    
                    2.1 客户端介绍
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1.1" >
            
                <span>
            
                    
                    2.1.1 psql
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.1.2" >
            
                <span>
            
                    
                    2.1.2 qgis
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3.2" >
            
                <span>
            
                    
                    2.2 空间数据库
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" >
            
                <span>
            
                    
                    2.3 数据导入
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.3.1" >
            
                <span>
            
                    
                    2.3.1 shp
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.2" >
            
                <span>
            
                    
                    2.3.2 csv
            
                </span>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3.3" >
            
                <span>
            
                    
                    2.3.3 excel
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="header">第 Ⅱ 部分：API手册</li>
        
        
    
        <li class="chapter " data-level="2.1" >
            
                <span>
            
                    
                    八 矢量函数
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1.1" >
            
                <span>
            
                    
                    8.2 空间表管理
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1.1.1" data-path="TableManager/AddGeometryColumn.html">
            
                <a href="TableManager/AddGeometryColumn.html">
            
                    
                    8.2.1 AddGeometryColumn
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.1.2" data-path="TableManager/DropGeometryColumn.html">
            
                <a href="TableManager/DropGeometryColumn.html">
            
                    
                    8.2.2 DropGeometryColumn
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.1.3" data-path="TableManager/DropGeometryTable.html">
            
                <a href="TableManager/DropGeometryTable.html">
            
                    
                    8.2.3 DropGeometryTable
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.1.4" data-path="TableManager/Find_SRID.html">
            
                <a href="TableManager/Find_SRID.html">
            
                    
                    8.2.4 Find_SRID
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.1.5" data-path="TableManager/Populate_Geometry_Columns.html">
            
                <a href="TableManager/Populate_Geometry_Columns.html">
            
                    
                    8.2.5 Populate_Geometry_Columns
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.1.6" data-path="TableManager/UpdateGeometrySRID.html">
            
                <a href="TableManager/UpdateGeometrySRID.html">
            
                    
                    8.2.6 UpdateGeometrySRID
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.1.2" >
            
                <span>
            
                    
                    8.4 元数据读写
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1.2.1" data-path="Accessors.html">
            
                <a href="Accessors.html#GeometryType">
            
                    
                    GeometryType
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2.2" data-path="Accessors.html">
            
                <a href="Accessors.html#ST_GeometryType">
            
                    
                    ST_GeometryType
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2.3" data-path="Accessors.html">
            
                <a href="Accessors.html#ST_CoordDim">
            
                    
                    ST_CoordDim与ST_NDims
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2.4" data-path="Accessors.html">
            
                <a href="Accessors.html#ST_Dimension">
            
                    
                    ST_Dimension
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2.5" data-path="Accessors.html">
            
                <a href="Accessors.html#ST_Zmflag">
            
                    
                    ST_Zmflag
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2.6" data-path="Accessors.html">
            
                <a href="Accessors.html#ST_HasArc">
            
                    
                    ST_HasArc
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2.7" data-path="Accessors.html">
            
                <a href="Accessors.html#ST_IsPolygonCCW">
            
                    
                    ST_IsPolygonCCW
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2.8" data-path="Accessors.html">
            
                <a href="Accessors.html#ST_IsPolygonCW">
            
                    
                    ST_IsPolygonCW
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2.9" data-path="Accessors.html">
            
                <a href="Accessors.html#ST_IsClosed">
            
                    
                    ST_IsClosed
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2.10" data-path="Accessors.html">
            
                <a href="Accessors.html#ST_IsCollection">
            
                    
                    ST_IsCollection
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2.11" data-path="Accessors.html">
            
                <a href="Accessors.html#ST_IsEmpty">
            
                    
                    ST_IsEmpty
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2.12" data-path="Accessors.html">
            
                <a href="Accessors.html#ST_IsRing">
            
                    
                    ST_IsRing
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2.13" data-path="Accessors.html">
            
                <a href="Accessors.html#ST_IsSimple">
            
                    
                    ST_IsSimple
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2.14" data-path="Accessors.html">
            
                <a href="Accessors.html#ST_Boundary">
            
                    
                    ST_Boundary
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2.15" data-path="Accessors.html">
            
                <a href="Accessors.html#ST_Envelope">
            
                    
                    ST_Envelope
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2.16" data-path="Accessors.html">
            
                <a href="Accessors.html#ST_BoundingDiagonal">
            
                    
                    ST_BoundingDiagonal
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2.17" data-path="Accessors.html">
            
                <a href="Accessors.html#ST_X">
            
                    
                    ST_X,ST_Y,ST_Z,ST_M
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2.18" data-path="Accessors.html">
            
                <a href="Accessors.html#ST_StartPoint">
            
                    
                    ST_StartPoint,ST_EndPoint
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2.19" data-path="Accessors.html">
            
                <a href="Accessors.html#ST_NumGeometries">
            
                    
                    ST_NumGeometries,ST_GeometryN
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2.20" data-path="Accessors.html">
            
                <a href="Accessors.html#ST_NRings">
            
                    
                    ST_NRings,ST_ExteriorRing,ST_NumInteriorRings,ST_NumInteriorRing,ST_InteriorRingN
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2.21" data-path="Accessors.html">
            
                <a href="Accessors.html#ST_NumPatches">
            
                    
                    ST_NumPatches,ST_PatchN
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2.22" data-path="Accessors.html">
            
                <a href="Accessors.html#ST_NPoints">
            
                    
                    ST_NPoints,ST_NumPoints,ST_PointN,ST_Points
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2.23" data-path="Accessors.html">
            
                <a href="Accessors.html#ST_MemSize">
            
                    
                    ST_MemSize
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2.24" data-path="Accessors.html">
            
                <a href="Accessors.html#ST_Summary">
            
                    
                    ST_Summary
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2.25" data-path="Accessors.html">
            
                <a href="Accessors.html#ST_Dump">
            
                    
                    ST_Dump,ST_DumpPoints,ST_DumpRings
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.1.3" >
            
                <span>
            
                    
                    8.11 空间关系
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1.3.1" data-path="SpatialRelationships.html">
            
                <a href="SpatialRelationships.html#ST_Intersects">
            
                    
                    ST_Intersects
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.3.2" data-path="SpatialRelationships.html">
            
                <a href="SpatialRelationships.html#ST_Intersects">
            
                    
                    ST_Disjoint
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.3.3" data-path="SpatialRelationships.html">
            
                <a href="SpatialRelationships.html#ST_Contains">
            
                    
                    ST_Contains
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.3.4" data-path="SpatialRelationships.html">
            
                <a href="SpatialRelationships.html#ST_Contains">
            
                    
                    ST_Within
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.3.5" data-path="SpatialRelationships.html">
            
                <a href="SpatialRelationships.html#ST_Equals">
            
                    
                    ST_Equals
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.3.6" data-path="SpatialRelationships.html">
            
                <a href="SpatialRelationships.html#ST_ContainsProperly">
            
                    
                    ST_ContainsProperly
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.3.7" data-path="SpatialRelationships.html">
            
                <a href="SpatialRelationships.html#ST_Covers">
            
                    
                    ST_Covers
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.3.8" data-path="SpatialRelationships.html">
            
                <a href="SpatialRelationships.html#ST_Covers">
            
                    
                    ST_CoveredBy
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.3.9" data-path="SpatialRelationships.html">
            
                <a href="SpatialRelationships.html#ST_Overlaps">
            
                    
                    ST_Overlaps
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.3.10" data-path="SpatialRelationships.html">
            
                <a href="SpatialRelationships.html#ST_Overlaps">
            
                    
                    ST_Crosses
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.3.11" data-path="SpatialRelationships.html">
            
                <a href="SpatialRelationships.html#ST_Touches">
            
                    
                    ST_Touches
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.3.12" data-path="SpatialRelationships.html">
            
                <a href="SpatialRelationships.html#ST_Relate">
            
                    
                    ST_Relate
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.3.13" data-path="SpatialRelationships.html">
            
                <a href="SpatialRelationships.html#ST_RelateMatch">
            
                    
                    ST_RelateMatch
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.1.4" >
            
                <span>
            
                    
                    8.12 空间测量
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1.4.1" data-path="Measurement/ST_3DClosestPoint.html">
            
                <a href="Measurement/ST_3DClosestPoint.html#ST_3DClosestPoint">
            
                    
                    ST_3DClosestPoint
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.4.2" data-path="Measurement/ST_3DDistance.html">
            
                <a href="Measurement/ST_3DDistance.html">
            
                    
                    ST_3DDistance
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.4.3" data-path="Measurement/ST_Angle.html">
            
                <a href="Measurement/ST_Angle.html">
            
                    
                    ST_Angle
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.4.4" data-path="Measurement/ST_Area.html">
            
                <a href="Measurement/ST_Area.html">
            
                    
                    ST_Area
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.4.5" data-path="Measurement/ST_Azimuth.html">
            
                <a href="Measurement/ST_Azimuth.html">
            
                    
                    ST_Azimuth
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.4.6" data-path="Measurement/ST_ClosestPoint.html">
            
                <a href="Measurement/ST_ClosestPoint.html">
            
                    
                    ST_ClosestPoint
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.4.7" data-path="Measurement/ST_Distance.html">
            
                <a href="Measurement/ST_Distance.html">
            
                    
                    ST_Distance
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.4.8" data-path="Measurement/ST_Project.html">
            
                <a href="Measurement/ST_Project.html">
            
                    
                    ST_Project
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.1.5" >
            
                <span>
            
                    
                    8.14 仿射变换
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1.5.1" data-path="AffineTransformations/ST_Affine.html">
            
                <a href="AffineTransformations/ST_Affine.html#ST_Affine">
            
                    
                    ST_Affine
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.5.2" data-path="AffineTransformations/ST_Rotate.html">
            
                <a href="AffineTransformations/ST_Rotate.html">
            
                    
                    ST_Rotate
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.5.3" data-path="AffineTransformations/ST_RotateX.html">
            
                <a href="AffineTransformations/ST_RotateX.html">
            
                    
                    ST_RotateX
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.5.4" data-path="AffineTransformations/ST_RotateY.html">
            
                <a href="AffineTransformations/ST_RotateY.html">
            
                    
                    ST_RotateY
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.5.5" data-path="AffineTransformations/ST_RotateZ.html">
            
                <a href="AffineTransformations/ST_RotateZ.html">
            
                    
                    ST_RotateZ
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.5.6" data-path="AffineTransformations/ST_Scale.html">
            
                <a href="AffineTransformations/ST_Scale.html">
            
                    
                    ST_Scale
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.5.7" data-path="AffineTransformations/ST_Translate.html">
            
                <a href="AffineTransformations/ST_Translate.html">
            
                    
                    ST_Translate
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.5.8" data-path="AffineTransformations/ST_TransScale.html">
            
                <a href="AffineTransformations/ST_TransScale.html">
            
                    
                    ST_TransScale
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.1.6" >
            
                <span>
            
                    
                    8.15 空间聚类
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1.6.1" data-path="Clustering.html">
            
                <a href="Clustering.html#ST_ClusterDBSCAN">
            
                    
                    ST_ClusterDBSCAN
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.6.2" data-path="Clustering.html">
            
                <a href="Clustering.html#ST_ClusterIntersecting">
            
                    
                    ST_ClusterIntersecting
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.6.3" data-path="Clustering.html">
            
                <a href="Clustering.html#ST_ClusterKMeans">
            
                    
                    ST_ClusterKMeans
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.6.4" data-path="Clustering.html">
            
                <a href="Clustering.html#ST_ClusterWithin">
            
                    
                    ST_ClusterWithin
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.1.7" >
            
                <span>
            
                    
                    8.16 线性参考
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1.7.1" data-path="LinearReferencing/ST_LineInterpolatePoint.html">
            
                <a href="LinearReferencing/ST_LineInterpolatePoint.html">
            
                    
                    ST_LineInterpolatePoint
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.7.2" data-path="LinearReferencing/ST_3dLineInterpolatePoint.html">
            
                <a href="LinearReferencing/ST_3dLineInterpolatePoint.html">
            
                    
                    ST_3dLineInterpolatePoint
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.7.3" data-path="LinearReferencing/ST_LineInterpolatePoints.html">
            
                <a href="LinearReferencing/ST_LineInterpolatePoints.html">
            
                    
                    ST_LineInterpolatePoints
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.7.4" data-path="LinearReferencing/ST_LineLocatePoint.html">
            
                <a href="LinearReferencing/ST_LineLocatePoint.html">
            
                    
                    ST_LineLocatePoint
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.7.5" data-path="LinearReferencing/ST_LineSubstring.html">
            
                <a href="LinearReferencing/ST_LineSubstring.html">
            
                    
                    ST_LineSubstring
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.7.6" data-path="LinearReferencing/ST_LocateAlong.html">
            
                <a href="LinearReferencing/ST_LocateAlong.html">
            
                    
                    ST_LocateAlong
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.7.7" data-path="LinearReferencing/ST_LocateBetween.html">
            
                <a href="LinearReferencing/ST_LocateBetween.html">
            
                    
                    ST_LocateBetween
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.7.8" data-path="LinearReferencing/ST_LocateBetweenElevations.html">
            
                <a href="LinearReferencing/ST_LocateBetweenElevations.html">
            
                    
                    ST_LocateBetweenElevations
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.7.9" data-path="LinearReferencing/ST_InterpolatePoint.html">
            
                <a href="LinearReferencing/ST_InterpolatePoint.html">
            
                    
                    ST_InterpolatePoint
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.7.10" data-path="LinearReferencing/ST_AddMeasure.html">
            
                <a href="LinearReferencing/ST_AddMeasure.html">
            
                    
                    ST_AddMeasure
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.7.11" data-path="LinearReferencing/examples.html">
            
                <a href="LinearReferencing/examples.html">
            
                    
                    综合案例
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="header">第 Ⅲ 部分：PostGIS++</li>
        
        
    

    
        
        <li class="header">第 Ⅳ 部分：常见问题</li>
        
        
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >GeometryType</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h2 id="84-&#x5143;&#x6570;&#x636E;&#x8BFB;&#x5199;">8.4 &#x5143;&#x6570;&#x636E;&#x8BFB;&#x5199;</h2>
<p><strong>&#x4EE5;&#x4E0B;&#x51FD;&#x6570;&#x8FD4;&#x56DE;&#x56FE;&#x5F62;&#x7C7B;&#x578B;&#x548C;&#x56FE;&#x5F62;&#x7C7B;&#x578B;&#x5BF9;&#x5E94;&#x7684;&#x5750;&#x6807;&#x548C;&#x62D3;&#x6251;&#x7EF4;&#x5EA6;&#x3002;</strong></p>
<h3 id="geometrytype"><span id="GeometryType">GeometryType</span></h3>
<p>&#x4F5C;&#x7528;&#xFF1A;&#x8FD4;&#x56DE;&#x56FE;&#x5F62;&#x7C7B;&#x578B;&#x5B57;&#x7B26;&#x4E32;&#xFF0C;&#x5B57;&#x7B26;&#x4E32;&#x5F62;&#x5F0F;&#x662F;&#xFF1A;&apos;POINT&apos;,&apos;LINESTRING&apos;,&apos;POLYGON&apos;,&apos;MULTIPOINT&apos;,&apos;MULTILINESTRING&apos;,&apos;MULTIPOLYGON&apos;&#x7B49;&#x7B49;&#x3002;</p>
<pre class="language-"><code>SELECT GeometryType(ST_GeomFromText(&apos;Point(118 32)&apos;));
    geometrytype
-------------------
    POINT


SELECT GeometryType(ST_GeomFromText(&apos;LineString(118 32,119 33)&apos;));
    geometrytype
-------------------
    LINESTRING
</code></pre><h3 id="stgeometrytype"><span id="ST_GeometryType">ST_GeometryType</span></h3>
<p>&#x4F5C;&#x7528;&#xFF1A;&#x8FD4;&#x56DE;&#x56FE;&#x5F62;&#x7C7B;&#x578B;SQL_MM&#x5B57;&#x7B26;&#x4E32;&#xFF0C;&#x5B57;&#x7B26;&#x4E32;&#x5F62;&#x5F0F;&#x662F;&#xFF1A;&apos;ST_Point&apos;,&apos;ST_Linestring&apos;,&apos;ST_Polygon&apos;,&apos;ST_MultiPoint&apos;,&apos;ST_MultiLinestring&apos;,&apos;ST_MultiPolygon&apos;&#x7B49;&#x7B49;&#x3002;</p>
<pre class="language-"><code>SELECT ST_GeometryType(ST_GeomFromText(&apos;Point(118 32)&apos;));
    st_geometrytype
-------------------
    ST_Point


SELECT ST_GeometryType(ST_GeomFromText(&apos;LineString(118 32,119 33)&apos;));
    st_geometrytype
-------------------
    ST_Linestring
</code></pre><h3 id="stcoorddimstndims"><span id="ST_CoordDim">ST_CoordDim/ST_NDims</span></h3>
<p>&#x4F5C;&#x7528;&#xFF1A;&#x4E24;&#x4E2A;&#x51FD;&#x6570;&#x4E00;&#x6A21;&#x4E00;&#x6837;&#xFF0C;&#x90FD;&#x662F;&#x8FD4;&#x56DE;&#x56FE;&#x5F62;&#x5750;&#x6807;&#x7EF4;&#x5EA6;&#xFF0C;&#x5982;&#x4E8C;&#x7EF4;&#x8FD4;&#x56DE;2&#xFF0C;xyz,xym&#x90FD;&#x8FD4;&#x56DE;3&#xFF0C;xyzm&#x8FD4;&#x56DE;4&#x3002;</p>
<table>
<thead>
<tr>
<th>&#x5750;&#x6807;&#x5F62;&#x5F0F;</th>
<th>&#x7EF4;&#x5EA6;</th>
</tr>
</thead>
<tbody>
<tr>
<td>xy</td>
<td>2</td>
</tr>
<tr>
<td>xyz</td>
<td>3</td>
</tr>
<tr>
<td>xym</td>
<td>3</td>
</tr>
<tr>
<td>xyzm</td>
<td>4</td>
</tr>
</tbody>
</table>
<pre class="language-"><code>--xy
SELECT ST_CoordDim(ST_GeomFromText(&apos;Point(1 2)&apos;));
 st_coorddim
-------------
    2
--xyz
SELECT ST_CoordDim(ST_GeomFromText(&apos;PointZ(1 2 3&apos;));
 st_coorddim
-------------
    3
--xym
SELECT ST_CoordDim(ST_GeomFromText(&apos;PointM(1 2 3&apos;));
 st_coorddim
-------------
    3
--xyzm
SELECT ST_CoordDim(ST_GeomFromText(&apos;PointZM(1 2 2 2&apos;));
 st_coorddim
-------------
    4
</code></pre><h3 id="stdimension"><span id="ST_Dimension">ST_Dimension</span></h3>
<p>&#x4F5C;&#x7528;&#xFF1A;&#x8FD4;&#x56DE;&#x56FE;&#x5F62;&#x7684;&#x62D3;&#x6251;&#x7EF4;&#x5EA6;&#xFF0C;&#x62D3;&#x6251;&#x7EF4;&#x5EA6;&#x53EA;&#x533A;&#x5206;&#x5927;&#x7C7B;&#xFF0C;&#x5982;POINT&#x5F62;&#x5F0F;&#xFF0C;&#x5B50;&#x5F62;&#x5F0F;&#x5305;&#x62EC;MULTIPOINT,POINTZ,POINTM,POINTZM&#xFF0C;&#x7EDF;&#x7EDF;&#x90FD;&#x8FD4;&#x56DE;0&#xFF0C;&#x4EE5;&#x6B64;&#x7C7B;&#x63A8;&#x3002;
&#x51E0;&#x4F55;&#x62D3;&#x6251;&#x5F62;&#x5F0F; | &#x7EF4;&#x5EA6;
---|---
POINT | 0
LINESTRING | 1
POLYGON | 2
EMPTY | -1</p>
<pre class="language-"><code>--xy&#x70B9;
SELECT ST_CoordDim(ST_GeomFromText(&apos;Point(1 2)&apos;));
 ST_Dimension
-------------
    0
--multi&#x70B9;
SELECT ST_CoordDim(ST_GeomFromText(&apos;MultiPoint(1 2,3 4)&apos;));
 ST_Dimension
-------------
    0
--xyz&#x70B9;
SELECT ST_CoordDim(ST_GeomFromText(&apos;PointZ(1 2 3&apos;));
 ST_Dimension
-------------
    0
--xym&#x70B9;
SELECT ST_CoordDim(ST_GeomFromText(&apos;PointM(1 2 3&apos;));
 ST_Dimension
-------------
    0
--xyzm&#x70B9;
SELECT ST_CoordDim(ST_GeomFromText(&apos;PointZM(1 2 2 2&apos;));
 ST_Dimension
-------------
    0
--linestring
SELECT ST_CoordDim(ST_GeomFromText(&apos;LineString(1 2,3 4)&apos;));
 ST_Dimension
-------------
    1
--polygon
SELECT ST_CoordDim(ST_GeomFromText(&apos;Polygon((0 0,0 1,1 1,1 0,0 0))&apos;));
 ST_Dimension
-------------
    2
</code></pre><p>&#x5BF9;&#x4E8E;&#x7C7B;&#x578B;&#x4E0D;&#x660E;&#x786E;&#x7684;&#xFF0C;&#x5982;GEOMETRYCOLLECTION&#xFF0C;&#x4F1A;&#x9009;&#x62E9;&#x96C6;&#x5408;&#x91CC;&#x7EF4;&#x5EA6;&#x6700;&#x9AD8;&#x7684;&#x5B50;&#x56FE;&#x5F62;&#xFF0C;&#x5C06;&#x8BE5;&#x5B50;&#x56FE;&#x5F62;&#x7684;&#x56FE;&#x5F62;&#x62D3;&#x6251;&#x7EF4;&#x5EA6;&#x8FD4;&#x56DE;&#xFF1A;</p>
<pre class="language-"><code>SELECT ST_Dimension(&apos;GEOMETRYCOLLECTION(LINESTRING(1 1,0 0),POINT(0 0))&apos;);
ST_Dimension
-----------
    1

SELECT ST_Dimension(&apos;GEOMETRYCOLLECTION(Polygon((0 0,0 1,1 1,1 0,0 0)),LINESTRING(1 1,0 0),POINT(0 0))&apos;);
ST_Dimension
-----------
    2
</code></pre><h3 id="stzmflag"><span id="ST_Zmflag">ST_Zmflag</span></h3>
<p>&#x4F5C;&#x7528;&#xFF1A;&#x8BE5;&#x51FD;&#x6570;&#x4E3B;&#x8981;&#x7528;&#x4E8E;&#x6D4B;&#x8BD5;&#x4E00;&#x4E2A;&#x56FE;&#x5F62;&#x7684;&#x5750;&#x6807;&#x7A76;&#x7ADF;&#x662F;&#x5E26;m&#x8FD8;&#x662F;&#x5E26;z&#x503C;&#xFF0C;&#x6839;&#x636E;&#x5176;&#x4E0D;&#x540C;&#x8F6C;&#x6001;&#x8FD4;&#x56DE;&#x80FD;&#x63D0;&#x73B0;zm&#x72B6;&#x6001;&#x7684;&#x7EF4;&#x5EA6;&#x7F16;&#x7801;&#x3002;
zm&#x5750;&#x6807;&#x5F62;&#x5F0F; | &#x7EF4;&#x5EA6;
---|---
xy | 0
xym | 1
xyz | 2
xyzm | 3
ST_Zmflag&#x4E0E;ST_CoordDim,ST_NDims&#x4E0D;&#x540C;&#xFF0C;ST_CoordDim,ST_NDims&#x4E2D;&#xFF0C;xyz&#x4E0E;xym&#x90FD;&#x8FD4;&#x56DE;3&#xFF0C;xyzm&#x8FD4;&#x56DE;4&#xFF0C;&#x8FD9;&#x4E24;&#x4E2A;&#x51FD;&#x6570;&#x8FD4;&#x56DE;&#x503C;&#x53EA;&#x662F;&#x8868;&#x8FBE;&#x4E86;&#x56FE;&#x5F62;&#x5750;&#x6807;&#x662F;&#x51E0;&#x7EF4;&#x6784;&#x6210;&#xFF0C;&#x4F46;&#x662F;&#x540C;&#x6837;&#x662F;&#x4E09;&#x7EF4;&#xFF0C;&#x7A76;&#x7ADF;&#x662F;xyz&#x8FD8;&#x662F;xym&#x662F;&#x533A;&#x5206;&#x4E0D;&#x4E86;&#x7684;&#x3002;&#x800C;&#x901A;&#x8FC7;ST_Zmflag&#x51FD;&#x6570;&#xFF0C;&#x80FD;&#x5F97;&#x5230;&#x51C6;&#x786E;&#x7684;&#x56FE;&#x5F62;&#x5750;&#x6807;&#x7A76;&#x7ADF;&#x662F;xyz&#x8FD8;&#x662F;xym&#x5F62;&#x5F0F;&#x3002;</p>
<pre class="language-"><code>SELECT ST_Zmflag(ST_GeomFromEWKT(&apos;LINESTRING(1 2, 3 4)&apos;));
st_zmflag
-----------
    0
SELECT ST_Zmflag(ST_GeomFromEWKT(&apos;LINESTRINGM(1 2 0, 3 4 0)&apos;));
st_zmflag
-----------
    1
SELECT ST_Zmflag(ST_GeomFromEWKT(&apos;LINESTRINGZ(1 2 0, 3 4 0)&apos;));
st_zmflag
-----------
    2
SELECT ST_Zmflag(ST_GeomFromEWKT(&apos;LINESTRINGZM(1 2 0 0, 3 4 0 0)&apos;));
st_zmflag
-----------
    3


--&#x5BF9;&#x6BD4;&#x4E0B;ST_CoordDim,ST_NDims
SELECT ST_CoordDim(ST_GeomFromEWKT(&apos;LINESTRINGZ(1 2 0, 3 4 0)&apos;));
ST_CoordDim
-----------
    3
SELECT ST_CoordDim(ST_GeomFromEWKT(&apos;LINESTRINGM(1 2 0, 3 4 0)&apos;));
ST_CoordDim
-----------
    3
--ST_CoordDim,ST_NDims&#x65E0;&#x6CD5;&#x533A;&#x5206;&#x7B2C;&#x4E09;&#x7EF4;&#x7A76;&#x7ADF;&#x662F;z&#x8FD8;&#x662F;m&#x3002;
</code></pre><p><strong>&#x4EE5;&#x4E0B;&#x51FD;&#x6570;&#x4E3A;&#x6D4B;&#x8BD5;&#x51FD;&#x6570;&#xFF0C;&#x5224;&#x522B;geometry&#x67D0;&#x4E2A;&#x5C5E;&#x6027;&#x662F;&#x5426;&#x5177;&#x5907;&#x67D0;&#x4E2A;&#x72B6;&#x6001;</strong>&#x3002;</p>
<h3 id="sthasarc"><span id="ST_HasArc">ST_HasArc</span></h3>
<p>&#x4F5C;&#x7528;&#xFF1A;&#x8BE5;&#x51FD;&#x6570;&#x4E3B;&#x8981;&#x7528;&#x4E8E;&#x6D4B;&#x8BD5;&#x4E00;&#x4E2A;&#x56FE;&#x5F62;&#x662F;&#x5426;&#x5305;&#x542B;&#x5706;&#x5F27;&#x3002;&#x5224;&#x65AD;&#x4F9D;&#x636E;&#x6BD4;&#x8F83;&#x52C9;&#x5F3A;&#xFF0C;&#x4EC5;&#x4EC5;&#x5224;&#x65AD;&#x56FE;&#x5F62;&#x6216;&#x8005;&#x56FE;&#x5F62;&#x96C6;&#x5408;&#x4E2D;&#x7684;&#x5B50;&#x56FE;&#x5F62;&#x662F;&#x4E0D;&#x662F;&#x5305;&#x542B;&#x5706;&#x5F27;&#x6807;&#x5FD7;&#x7684;&#x5B57;&#x7B26;&#x4E32;&#x3002;</p>
<p>&#x4E0B;&#x4F8B;&#x4EE5;CIRCULARSTRING(1 1, 2 2, 3 3, 4 4, 5 5)&#x8BF4;&#x660E;&#xFF0C;&#x8FD9;&#x4E2A;&#x5706;&#x5F27;&#x957F;&#x4EC0;&#x4E48;&#x6837;&#x90FD;&#x4E0D;&#x77E5;&#x9053;&#xFF0C;&#x4F46;&#x662F;&#x53EA;&#x8981;&#x7528;CIRCULARSTRING&#x58F0;&#x660E;&#x5176;&#x662F;&#x5706;&#x5F27;&#xFF0C;&#x5C31;&#x4F1A;&#x8FD4;&#x56DE;true&#x3002;&#x5706;&#x5F27;&#x5728;PostGIS&#x4E2D;&#x5176;&#x5B9E;&#x80FD;&#x6784;&#x9020;&#x4F46;&#x662F;&#x5176;&#x4ED6;&#x53EF;&#x89C6;&#x5316;&#x8F6F;&#x4EF6;&#x4E0D;&#x8BA4;&#x8BC6;&#xFF0C;&#x65E0;&#x6CD5;&#x53EF;&#x89C6;&#x5316;&#x3002;&#x8BE5;&#x51FD;&#x6570;&#x4F7F;&#x7528;&#x9891;&#x7387;&#x5176;&#x5B9E;&#x4E5F;&#x975E;&#x5E38;&#x4F4E;&#x3002;</p>
<pre class="language-"><code>SELECT ST_HasArc(ST_GeomFromEWKT(&apos;CIRCULARSTRING(1 1, 2 2, 3 3, 4 4, 5 5)&apos;));
st_hasarc
--------
  true
</code></pre><h3 id="stispolygonccw"><span id="ST_IsPolygonCCW">ST_IsPolygonCCW</span></h3>
<p>&#x4F5C;&#x7528;&#xFF1A;&#x6D4B;&#x8BD5;&#x591A;&#x8FB9;&#x5F62;&#x662F;&#x5426;&#x5177;&#x6709;&#x9006;&#x65F6;&#x9488;&#x65B9;&#x5411;&#x7684;&#x5916;&#x73AF;&#x548C;&#x987A;&#x65F6;&#x9488;&#x65B9;&#x5411;&#x7684;&#x5185;&#x73AF;&#x3002;</p>
<p><img src="http://localhost:4000/images/Accessors/ST_IsPolygonCCW.png" alt=""></p>
<pre class="language-"><code>--&#x5916;&#x73AF;&#x662F;&#x9006;&#x65F6;&#x9488;&#x65B9;&#x5411;&#xFF0C;&#x5185;&#x73AF;&#x662F;&#x987A;&#x65F6;&#x9488;&#x65B9;&#x5411;
select ST_IsPolygonCCW(ST_GeomFromEWKT(&apos;Polygon((0 0,3 0,3 3,0 3,0 0),(1 1,1 2,2 2,2 1,1 1))&apos;));
ST_IsPolygonCCW
-------------------
    true

--&#x5916;&#x73AF;&#x662F;&#x9006;&#x65F6;&#x9488;&#x65B9;&#x5411;&#xFF0C;&#x5185;&#x73AF;&#x4E5F;&#x662F;&#x9006;&#x65F6;&#x9488;&#x65B9;&#x5411;
select ST_IsPolygonCCW(ST_GeomFromEWKT(&apos;Polygon((0 0,3 0,3 3,0 3,0 0),(1 1,2 1,2 2,1 2,1 1))&apos;));
ST_IsPolygonCCW
-------------------
    false
</code></pre><h3 id="stispolygoncw"><span id="ST_IsPolygonCW">ST_IsPolygonCW</span></h3>
<p>&#x4F5C;&#x7528;&#xFF1A;&#x6D4B;&#x8BD5;&#x591A;&#x8FB9;&#x5F62;&#x662F;&#x5426;&#x5177;&#x6709;&#x987A;&#x65F6;&#x9488;&#x65B9;&#x5411;&#x7684;&#x5916;&#x73AF;&#x548C;&#x9006;&#x65F6;&#x9488;&#x65B9;&#x5411;&#x7684;&#x5185;&#x73AF;&#x3002;</p>
<p><img src="http://localhost:4000/images/Accessors/ST_IsPolygonCW.png" alt=""></p>
<pre class="language-"><code>select ST_IsPolygonCW(ST_GeomFromEWKT(&apos;Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,2 1,2 2,1 2,1 1))&apos;));
ST_IsPolygonCW
-------------------
    true
</code></pre><h3 id="stisclosed"><span id="ST_IsClosed">ST_IsClosed</span></h3>
<p>&#x4F5C;&#x7528;&#xFF1A;&#x5224;&#x522B;&#x4E00;&#x4E2A;&#x7EBF;&#x662F;&#x5426;&#x95ED;&#x5408;&#x3002;Polygon&#x4E00;&#x5B9A;&#x662F;&#x95ED;&#x5408;&#x7684;&#x5426;&#x5219;&#x6784;&#x9020;&#x4F1A;&#x51FA;&#x9519;&#xFF0C;&#x56E0;&#x6B64;&#xFF0C;&#x8BE5;&#x51FD;&#x6570;&#x5E38;&#x7528;&#x5C31;&#x662F;&#x5224;&#x522B;&#x7EBF;&#x3002;&#x6240;&#x8C13;&#x95ED;&#x5408;&#xFF0C;&#x5C31;&#x662F;<strong>&#x8D77;&#x70B9;=&#x7EC8;&#x70B9;</strong> &#xFF0C;&#x5373;&#x9996;&#x5C3E;&#x76F8;&#x8FDE;&#x3002;
&#x4E3B;&#x8981;&#x4F7F;&#x7528;&#x573A;&#x666F;&#xFF1A;</p>
<pre class="language-"><code>SELECT ST_IsClosed(ST_GeomFromEWKT(&apos;LINESTRING(0 0, 1 1)&apos;));
st_isclosed
-------------
   false
SELECT ST_IsClosed(ST_GeomFromEWKT(&apos;LINESTRING(0 0, 1 1,1 0,0 0)&apos;));
st_isclosed
-------------
   true
</code></pre><p>&#x4EE5;&#x4E0B;&#x573A;&#x666F;&#x4E0D;&#x5E38;&#x7528;&#xFF0C;&#x4F46;&#x662F;&#x8BE5;&#x51FD;&#x6570;&#x4E5F;&#x652F;&#x6301;&#xFF0C;&#x5E76;&#x4E14;&#x8FD4;&#x56DE;&#x7ED3;&#x679C;&#x6709;&#x70B9;&#x5DEE;&#x5F02;&#x3002;</p>
<p>&#x591A;&#x4E49;&#x7EBF;&#xFF0C;&#x6BCF;&#x4E2A;&#x5B50;&#x7EBF;&#x90FD;&#x662F;&#x9996;&#x5C3E;&#x76F8;&#x8FDE;&#x7684;&#xFF1A;</p>
<p><img src="http://localhost:4000/images/Accessors/ST_IsClosed1.png" alt=""></p>
<pre class="language-"><code>SELECT ST_IsClosed(ST_GeomFromEWKT(&apos;MULTILINESTRING((0 0, 1 1,1 0,0 0),(3 3,4 4,4 3,3 3))&apos;));
st_isclosed
-------------
   true
</code></pre><p>&#x591A;&#x4E49;&#x7EBF;&#xFF0C;&#x81F3;&#x5C11;&#x6709;&#x4E2A;&#x5B50;&#x7EBF;&#x4E0D;&#x662F;&#x9996;&#x5C3E;&#x76F8;&#x8FDE;&#x7684;&#xFF1A;</p>
<p><img src="http://localhost:4000/images/Accessors/ST_IsClosed2.png" alt=""></p>
<pre class="language-"><code>
SELECT ST_IsClosed(ST_GeomFromEWKT(&apos;MULTILINESTRING((0 0, 1 1,1 0,0 0),(3 3,4 4,4 3,3.5 3))&apos;));
st_isclosed
-------------
   true
</code></pre><p>&#x7ED3;&#x8BBA;&#xFF1A;&#x591A;&#x4E49;&#x7EBF;&#x5B9E;&#x9645;&#x662F;&#x8BA1;&#x7B97;&#x6BCF;&#x4E2A;&#x5B50;&#x7EBF;&#x662F;&#x5426;&#x95ED;&#x5408;&#xFF0C;&#x53EA;&#x6709;&#x6240;&#x6709;&#x5B50;&#x7EBF;&#x90FD;&#x95ED;&#x5408;&#xFF0C;&#x624D;&#x8FD4;&#x56DE;true&#xFF0C;&#x4EFB;&#x610F;&#x4E00;&#x4E2A;&#x5B50;&#x7EBF;&#x4E0D;&#x95ED;&#x5408;&#xFF0C;&#x5C31;&#x4F1A;&#x8FD4;&#x56DE;false&#x3002;</p>
<p>&#x6839;&#x636E;&#x95ED;&#x5408;&#x7684;&#x6982;&#x5FF5; &#x8D77;&#x70B9;=&#x7EC8;&#x70B9; &#x90A3;&#x4E48;&#x5BF9;&#x4E8E;&#x70B9;&#x800C;&#x8A00;&#xFF0C;&#x8D77;&#x70B9;&#x7EC8;&#x70B9;&#x5C31;&#x662F;&#x4E00;&#x4E2A;&#x70B9;&#xFF0C;&#x6240;&#x4EE5;&#x4E00;&#x5B9A;&#x8FD4;&#x56DE;true&#xFF1B;&#x800C;&#x591A;&#x4E49;&#x70B9;&#x548C;&#x591A;&#x4E49;&#x7EBF;&#x4E00;&#x6837;&#xFF0C;&#x662F;&#x5206;&#x522B;&#x8BA1;&#x7B97;&#x6BCF;&#x4E2A;&#x5B50;&#x56FE;&#x5F62;&#x662F;&#x5426;&#x95ED;&#x5408;&#xFF0C;&#x7531;&#x4E8E;MultiPoint&#x7684;&#x5B50;&#x56FE;&#x5F62;&#x90FD;&#x662F;Point&#xFF0C;&#x800C;Point&#x4E00;&#x5B9A;&#x8FD4;&#x56DE;true&#xFF0C;&#x90A3;&#x4E48;&#x610F;&#x5473;&#x7740;&#x4E8E;MultiPoint&#x7684;&#x5B50;&#x56FE;&#x5F62;&#x90FD;&#x662F;&#x95ED;&#x5408;&#x7684;&#x3002;</p>
<pre class="language-"><code>SELECT ST_IsClosed(&apos;POINT(0 0)&apos;::geometry);
st_isclosed
-------------
   true

SELECT ST_IsClosed(&apos;MULTIPOINT((0 0), (1 1))&apos;::geometry);
st_isclosed
-------------
    true
</code></pre><p>&#x7ED3;&#x8BBA;&#xFF1A;</p>
<pre class="language-"><code>1 &#x5BF9;&#x4E8E;&#x70B9;&#xFF0C;&#x591A;&#x4E49;&#x70B9;&#xFF0C;&#x8BE5;&#x51FD;&#x6570;&#x603B;&#x662F;&#x8FD4;&#x56DE;true&#x3002;
2 &#x5BF9;&#x4E8E;&#x7EBF;&#x9996;&#x5C3E;&#x76F8;&#x8FDE;&#x8BA4;&#x5B9A;&#x95ED;&#x5408;&#xFF0C;&#x591A;&#x4E49;&#x7EBF;&#x8981;&#x4FDD;&#x8BC1;&#x6BCF;&#x4E2A;&#x5B50;&#x7EBF;&#x90FD;&#x662F;&#x95ED;&#x5408;&#x624D;&#x8BA4;&#x4E3A;&#x591A;&#x4E49;&#x7EBF;&#x95ED;&#x5408;&#x3002;
3 &#x5BF9;&#x4E8E;&#x9762;&#xFF0C;&#x591A;&#x4E49;&#x9762;&#xFF0C;&#x7531;&#x4E8E;&#x9762;&#x4E00;&#x5B9A;&#x662F;&#x95ED;&#x5408;&#x7684;&#xFF0C;&#x56E0;&#x6B64;&#x8BE5;&#x51FD;&#x6570;&#x603B;&#x662F;&#x8FD4;&#x56DE;true&#x3002;
4 &#x8BE5;&#x51FD;&#x6570;&#x5176;&#x5B9E;&#x4EC5;&#x4EC5;&#x7528;&#x4E8E;&#x5224;&#x5B9A;LineString&#x662F;&#x5426;&#x95ED;&#x5408;&#x4E3A;&#x4E3B;&#x8981;&#x76EE;&#x7684;&#x3002;
</code></pre><h3 id="stiscollection"><span id="ST_IsCollection">ST_IsCollection</span></h3>
<p>&#x4F5C;&#x7528;&#xFF1A;&#x5224;&#x5B9A;&#x4E00;&#x4E2A;&#x56FE;&#x5F62;&#x662F;&#x5426;&#x662F;&#x96C6;&#x5408;&#x7C7B;&#x578B;&#xFF0C;&#x96C6;&#x5408;&#x7C7B;&#x578B;&#x5217;&#x8868;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre class="language-"><code>&#x2022; GEOMETRYCOLLECTION
&#x2022; MULTI{POINT,POLYGON,LINESTRING,CURVE,SURFACE}
&#x2022; COMPOUNDCURVE
</code></pre><p>&#x5F53;&#x56FE;&#x5F62;&#x7C7B;&#x578B;&#x4E3A;&#x5217;&#x8868;&#x7C7B;&#x578B;&#x65F6;&#xFF0C;&#x8BE5;&#x51FD;&#x6570;&#x8FD4;&#x56DE;true&#xFF0C;&#x5426;&#x5219;&#x8FD4;&#x56DE;false&#x3002;</p>
<pre class="language-"><code>--&#x5355;&#x7EBF;
SELECT ST_IsCollection(&apos;LINESTRING(0 0, 1 1)&apos;::geometry);
st_iscollection
-------------
    false
--&#x591A;&#x4E49;&#x7EBF;
SELECT ST_IsCollection(&apos;MultiLINESTRING((0 0, 1 1))&apos;::geometry);
st_iscollection
-------------
    true
</code></pre><h3 id="stisempty"><span id="ST_IsEmpty">ST_IsEmpty</span></h3>
<p>&#x4F5C;&#x7528;&#xFF1A;&#x5224;&#x5B9A;&#x4E00;&#x4E2A;&#x56FE;&#x5F62;&#x662F;&#x5426;&#x4E3A;&#x7A7A;&#x3002;</p>
<pre class="language-"><code>SELECT ST_IsEmpty(ST_GeomFromText(&apos;POLYGON EMPTY&apos;));
st_isempty
------------
    true

SELECT ST_IsEmpty(ST_GeomFromText(&apos;POLYGON((1 2, 3 4, 5 6, 1 2))&apos;));
st_isempty
------------
 false
</code></pre><h3 id="stisring"><span id="ST_IsRing">ST_IsRing</span></h3>
<p>&#x4F5C;&#x7528;&#xFF1A;&#x5224;&#x5B9A;&#x662F;&#x5426;&#x4E3A;&#x201C;&#x73AF;&#x201D;&#xFF0C;&#x56FE;&#x5F62;&#x4E2D;&#x7684;&#x6362;&#x201C;&#x73AF;&#x201D;&#x5176;&#x5B9E;&#x662F;&#x95ED;&#x5408;&#x7684;&#x5355;&#x7EBF;&#xFF0C;&#x6BD4;&#x5982;Polygon&#x5C31;&#x662F;&#x4E00;&#x4E2A;&#x4E2A;&#x73AF;&#x7EC4;&#x6210;&#x7684;&#x56FE;&#x5F62;&#x3002;&#x5BF9;&#x4E8E;&#x201C;&#x73AF;&#x201D;&#x7684;&#x5B9A;&#x4E49;&#x5E94;&#x6EE1;&#x8DB3;&#x5982;&#x4E0B;&#x4E24;&#x70B9;&#xFF1A;</p>
<pre class="language-"><code>1 &#x95ED;&#x5408;&#x7684;&#x7EBF;&#xFF0C;&#x5219;ST_IsClosed(geom)=true&#x3002;
2 &#x8BE5;&#x7EBF;&#x4E0D;&#x81EA;&#x76F8;&#x4EA4;&#xFF0C;&#x4E0D;&#x81EA;&#x76F8;&#x5207;&#xFF0C;&#x5219;ST_IsSimple(geom)=true&#x3002;
</code></pre><p>&#x200B;<br><img src="http://localhost:4000/images/Accessors/ST_IsRing1.png" alt=""></p>
<pre class="language-"><code>SELECT ST_IsRing(geom), ST_IsClosed(geom), ST_IsSimple(geom)
FROM (SELECT &apos;LINESTRING(0 0, 0 1, 1 1, 1 0, 0 0)&apos;::geometry AS geom) AS foo;
st_isring | st_isclosed | st_issimple
-----------+-------------+-------------
true      |   true      | true
</code></pre><p><img src="http://localhost:4000/images/Accessors/ST_IsRing2.png" alt=""></p>
<pre class="language-"><code>SELECT ST_IsRing(geom), ST_IsClosed(geom), ST_IsSimple(geom)
FROM (SELECT &apos;LINESTRING(0 0, 0 1, 1 0, 1 1, 0 0)&apos;::geometry AS geom) AS foo;
st_isring | st_isclosed | st_issimple
-----------+-------------+-------------
false     |  true       |  false
</code></pre><p><strong>&#x7ED3;&#x8BBA;&#xFF1A;&#x7531;&#x201C;&#x73AF;&#x201D;&#x5B9A;&#x4E49;&#x53EF;&#x77E5;&#xFF0C;&#x53EA;&#x6709;&#x5F53;&#x5219;ST_IsClosed&#x4E0E;&#x5219;ST_IsSimple&#x4E24;&#x4E2A;&#x51FD;&#x6570;&#x90FD;&#x8FD4;&#x56DE;true&#xFF0C;ST_IsRing(geom)&#x624D;&#x4F1A;&#x8FD4;&#x56DE;true&#x3002;</strong></p>
<h3 id="stissimple"><span id="ST_IsSimple">ST_IsSimple</span></h3>
<p>&#x4F5C;&#x7528;&#xFF1A;&#x5224;&#x5B9A;&#x4E00;&#x4E2A;&#x56FE;&#x5F62;&#x662F;&#x5426;&#x81EA;&#x76F8;&#x4EA4;&#x6216;&#x8005;&#x81EA;&#x76F8;&#x5207;&#x3002;
&#x793A;&#x610F;&#x56FE;&#x89C1;ST_IsRing&#x4E2D;&#x793A;&#x610F;&#x56FE;&#x3002;</p>
<pre class="language-"><code>SELECT ST_IsSimple(&apos;LINESTRING(0 0, 0 1, 1 1, 1 0, 0 0)&apos;::geometry);
st_issimple
-------------
 true

SELECT ST_IsSimple(&apos;LINESTRING(0 0, 0 1, 1 0, 1 1, 0 0)&apos;::geometry);
st_issimple
-------------
 false
</code></pre><p><strong>&#x4EE5;&#x4E0A;&#x51FD;&#x6570;&#x4E3A;&#x6D4B;&#x8BD5;&#x51FD;&#x6570;&#xFF0C;&#x5224;&#x522B;geometry&#x67D0;&#x4E2A;&#x5C5E;&#x6027;&#x662F;&#x5426;&#x5177;&#x5907;&#x67D0;&#x4E2A;&#x72B6;&#x6001;</strong>&#x3002;</p>
<h3 id="stboundary"><span id="ST_Boundary">ST_Boundary</span></h3>
<p>&#x4F5C;&#x7528;&#xFF1A;&#x8FD4;&#x56DE;&#x56FE;&#x5F62;&#x8FB9;&#x754C;&#xFF0C;&#x62BD;&#x8C61;&#xFF0C;&#x7528;&#x4F8B;&#x5B50;&#x8BF4;&#x660E;&#x3002;</p>
<p>1 &#x5BF9;&#x4E8E;&#x70B9;&#x800C;&#x8A00;&#xFF0C;&#x56FE;&#x5F62;&#x8FB9;&#x754C;&#x90FD;&#x662F;empty&#xFF1A;</p>
<pre class="language-"><code>SELECT ST_AsText(ST_Boundary(&apos;Point(1 1)&apos;::geometry));
       st_astext
------------------------
GEOMETRYCOLLECTION EMPTY


SELECT ST_AsText(ST_Boundary(&apos;MultiPoint(1 1,2 2)&apos;::geometry));
       st_astext
-------------------------
GEOMETRYCOLLECTION EMPTY
</code></pre><p>2 &#x5BF9;&#x4E8E;&#x672A;&#x95ED;&#x5408;&#x7EBF;&#x800C;&#x8A00;&#xFF0C;&#x56FE;&#x5F62;&#x8FB9;&#x754C;&#x662F;&#x5176;&#x8D77;&#x70B9;&#x548C;&#x7EC8;&#x70B9;&#xFF1A;</p>
<p><img src="http://localhost:4000/images/Accessors/ST_Boundary1.png" alt=""></p>
<pre class="language-"><code>SELECT ST_AsText(ST_Boundary(&apos;LINESTRING(1 1,2 2,3 -1)&apos;::geometry));
       st_astext
-------------------------
 MULTIPOINT(1 1,3 -1)

SELECT ST_AsText(ST_Boundary(&apos;MultiLINESTRING((1 1,2 2,3 -1),(0 0,-1 -1,-2 3))&apos;::geometry));
       st_astext
------------------------------
 MULTIPOINT(1 1,3 -1,0 0,-2 3)
</code></pre><p>&#x8865;&#x5145;&#xFF1A;&#x5BF9;MultiLINESTRING&#x800C;&#x8A00;&#xFF0C;&#x5206;&#x522B;&#x8BA1;&#x7B97;&#x5B50;&#x7EBF;&#x7684;&#x8FB9;&#x754C;&#xFF08;&#x8D77;&#x70B9;&#xFF0C;&#x7EC8;&#x70B9;&#xFF09;&#xFF0C;&#x7136;&#x540E;&#x628A;&#x6240;&#x6709;&#x5B50;&#x7EBF;&#x7684;&#x8FB9;&#x754C;&#xFF08;&#x90FD;&#x662F;&#x70B9;&#xFF09;&#x585E;&#x5230;&#x4E00;&#x4E2A;MULTIPOINT&#x8FD4;&#x56DE;&#x3002;</p>
<p>3 &#x5BF9;&#x4E8E;&#x95ED;&#x5408;&#x7EBF;&#xFF0C;&#x56FE;&#x5F62;&#x8FB9;&#x754C;&#x4E3A;&#x7A7A;&#xFF1A;</p>
<pre class="language-"><code>SELECT ST_AsText(ST_Boundary(&apos;LINESTRING(1 1,2 2,3 -1,1 1)&apos;::geometry));
       st_astext
------------------------
   MULTIPOINT EMPTY
</code></pre><p>4 &#x5BF9;&#x4E8E;&#x9762;&#x800C;&#x8A00;&#xFF0C;&#x56FE;&#x5F62;&#x8FB9;&#x754C;&#x662F;&#x5176;&#x73AF;&#xFF1A;</p>
<p>&#x5355;&#x4E49;&#x9762;&#xFF1A;</p>
<p><img src="http://localhost:4000/images/Accessors/ST_Boundary2.png" alt=""></p>
<pre class="language-"><code>select ST_AsText(ST_Boundary(ST_GeomFromEWKT(&apos;Polygon((0 0,3 0,3 3,0 3,0 0),(1 1,1 2,2 2,2 1,1 1))&apos;)));
       st_astext
------------------------------------------------------------
MULTILINESTRING((0 0,3 0,3 3,0 3,0 0),(1 1,1 2,2 2,2 1,1 1))
</code></pre><p>&#x591A;&#x4E49;&#x9762;&#xFF1A;</p>
<p><img src="http://localhost:4000/images/Accessors/ST_Boundary3.png" alt=""></p>
<pre class="language-"><code>select ST_AsText(ST_Boundary(
    ST_GeomFromEWKT(&apos;MultiPolygon(((0 0,1 0,1 1,0 1,0 0)),((2 2,2 3,3 3,3 2,2 2)))&apos;)));
       st_astext
------------------------------------------------------------
MULTILINESTRING((0 0,1 0,1 1,0 1,0 0),(2 2,2 3,3 3,3 2,2 2))
</code></pre><h3 id="stenvelope"><span id="ST_Envelope">ST_Envelope</span></h3>
<p>&#x4F5C;&#x7528;&#xFF1A;&#x8FD4;&#x56DE;&#x4E00;&#x4E2A;&#x56FE;&#x5F62;&#x7684;&#x5916;&#x63A5;&#x77E9;&#x5F62;&#x3002;&#x70B9;&#x7684;&#x5916;&#x63A5;&#x77E9;&#x5F62;&#x662F;Point&#xFF0C;&#x7EBF;&#x9762;&#x7684;&#x5916;&#x63A5;&#x77E9;&#x5F62;&#x662F;&#x4E2A;&#x957F;&#x65B9;&#x5F62;Polygon&#xFF0C;<strong>xyz&#x7684;&#x7EBF;&#x9762;&#x5916;&#x63A5;&#x77E9;&#x5F62;&#x4ECD;&#x7136;&#x662F;xy&#x7EF4;&#x5EA6;&#x91CC;&#x7684;&#x957F;&#x65B9;&#x5F62;&#xFF0C;&#x800C;&#x975E;&#x5B98;&#x65B9;&#x624B;&#x518C;&#x8BF4;&#x7684;&#x957F;&#x65B9;&#x4F53;</strong>&#x3002;</p>
<pre class="language-"><code>--&#x70B9;
SELECT ST_AsText(ST_Envelope(&apos;POINT(1 3)&apos;::geometry));
st_astext
------------
POINT(1 3)

--&#x7EBF;
SELECT ST_AsText(ST_Envelope(&apos;LineString(0 0,1 1)&apos;::geometry));
          st_astext
------------------------------
POLYGON((0 0,0 1,1 1,1 0,0 0))

--&#x9762;
SELECT ST_AsText(ST_Envelope(&apos;Polygon((0 0,1 0,1 1,0 1,0 0))&apos;::geometry));
          st_astext
------------------------------
POLYGON((0 0,0 1,1 1,1 0,0 0))

--xyz &#x7EBF;
SELECT ST_AsText(ST_Envelope(&apos;LineStringZ(0 0 0,1 1 1)&apos;::geometry));
          st_astext
------------------------------
POLYGON((0 0,0 1,1 1,1 0,0 0))

--xyz&#x9762;
SELECT ST_AsText(ST_Envelope(&apos;PolygonZ((0 0 0,1 0 1,1 1 1,0 1 0,0 0 0))&apos;::geometry));
          st_astext
------------------------------
POLYGON((0 0,0 1,1 1,1 0,0 0))
</code></pre><p><strong>&#x8BF4;&#x660E;&#xFF1A;xyz&#x7684;&#x7EBF;&#x9762;&#x8FD4;&#x56DE;&#x8FD8;&#x662F;&#x4E8C;&#x7EF4;&#x7684;xy&#x9762;&#xFF0C;z&#x8F74;&#x88AB;&#x4E22;&#x5931;&#x4E86;&#x3002;</strong></p>
<h4 id="stenvelope&#x4E0E;box2d">ST_Envelope&#x4E0E;Box2D</h4>
<p>&#x76F8;&#x540C;&#x70B9;&#xFF1A;ST_Envelope&#x4E0E;Box2D&#x90FD;&#x662F;&#x83B7;&#x53D6;&#x8F93;&#x5165;&#x56FE;&#x5F62;&#x7684;&#x5916;&#x63A5;&#x77E9;&#x5F62;&#x3002;</p>
<p>&#x4E0D;&#x540C;&#x70B9;&#xFF1A;ST_Envelope&#x8FD4;&#x56DE;&#x7684;&#x662F;&#x4E2A;geometry&#x5BF9;&#x8C61;&#xFF0C;&#x5982;&apos;Polygon((minx miny,minx maxy,maxx maxy,maxx miny,minx miny))::geometry&apos;&#xFF1B;Box2D&#x8FD4;&#x56DE;&#x7684;&#x662F;box2d&#x5BF9;&#x8C61;&#xFF0C;&#x5982;BOX(minx,miny,maxx,maxy)&#x3002;</p>
<h3 id="stboundingdiagonal"><span id="ST_BoundingDiagonal">ST_BoundingDiagonal</span></h3>
<p>&#x4F5C;&#x7528;&#xFF1A;&#x8FD4;&#x56DE;&#x4E00;&#x4E2A;&#x56FE;&#x5F62;&#x8FB9;&#x754C;&#x6846;&#x6784;&#x6210;&#x7684;&#x5BF9;&#x89D2;&#x7EBF;&#x3002;&#x8BE5;&#x51FD;&#x6570;&#x4F1A;&#x4FDD;&#x7559;&#x6240;&#x6709;&#x7684;srid&#x548C;zm&#x7EF4;&#x5EA6;&#x3002;</p>
<p>&#x51FD;&#x6570;&#x5B9A;&#x4E49;&#xFF1A;ST_BoundingDiagonal(geometry geom, boolean fits=false)</p>
<p>&#x53C2;&#x6570;&#x8BF4;&#x660E;&#xFF1A;fits&#x53C2;&#x6570;&#x8868;&#x793A;&#x662F;&#x5426;&#x91C7;&#x7528;&#x6700;&#x4F73;&#x62DF;&#x5408;&#xFF0C;&#x5728;&#x8F93;&#x5165;&#x56FE;&#x5F62;&#x8282;&#x70B9;&#x5F88;&#x591A;&#x7684;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;fits=true&#x5219;&#x83B7;&#x53D6;&#x7684;&#x8FB9;&#x754C;&#x6846;&#x6784;&#x6210;&#x7684;&#x5BF9;&#x89D2;&#x7EBF;&#x66F4;&#x7CBE;&#x786E;&#x70B9;&#xFF0C;&#x4F46;&#x662F;&#x7A0D;&#x6162;&#xFF1B;fits=false&#x5219;&#x83B7;&#x53D6;&#x7684;&#x8FB9;&#x754C;&#x6846;&#x8303;&#x56F4;&#x7A0D;&#x5927;&#xFF0C;&#x4F46;&#x662F;&#x901F;&#x5EA6;&#x66F4;&#x5FEB;&#x3002;fits&#x65E0;&#x8BBA;true&#x6216;false&#xFF0C;&#x5BF9;&#x89D2;&#x7EBF;&#x6784;&#x6210;&#x7684;&#x8FB9;&#x754C;&#x6846;&#x90FD;&#x4F1A;&#x8986;&#x76D6;&#x8F93;&#x5165;&#x56FE;&#x5F62;&#xFF08;&#x5BF9;&#x89D2;&#x7EBF;&#x7684;bbox&gt;=&#x8F93;&#x5165;&#x56FE;&#x5F62;&#x7684;bbox&#xFF09;</p>
<pre class="language-"><code>--xy
SELECT ST_AsText(ST_BoundingDiagonal(&apos;Polygon((0 0,1 0,1 1,0 1,0 0))&apos;::geometry));
        st_astext
---------------------------
   LINESTRING(0 0,1 1)

--xyz
SELECT ST_AsText(ST_BoundingDiagonal(&apos;PolygonZ((0 0 0,1 0 1,1 1 1,0 1 0,0 0 0))&apos;::geometry));
        st_astext
---------------------------
LINESTRING Z (0 0 0,1 1 1)
</code></pre><h3 id="stxstystzstm"><span id="ST_X">ST_X,ST_Y,ST_Z,ST_M</span></h3>
<p>&#x4F5C;&#x7528;&#xFF1A;ST_X,ST_Y,ST_Z,ST_M&#x56DB;&#x4E2A;&#x51FD;&#x6570;&#x5206;&#x522B;&#x8FD4;&#x56DE;Point&#x7684;x&#xFF0C;y&#xFF0C;z&#xFF0C;m&#x503C;&#xFF0C;<strong>&#x5165;&#x53C2;&#x5FC5;&#x987B;&#x662F;Point</strong>&#x3002;</p>
<pre class="language-"><code>SELECT ST_X(geom), ST_Y(geom), ST_Z(geom),ST_M(geom)
FROM (SELECT ST_GeomFromEWKT(&apos;POINT(1 2 3 4)&apos;) AS geom) AS foo;
st_x | st_y | st_z | st_m
--------------------------
 1   |  2   |  3   |   4
</code></pre><h3 id="ststartpointstendpoint"><span id="ST_StartPoint">ST_StartPoint,ST_EndPoint</span></h3>
<p>&#x4F5C;&#x7528;&#xFF1A;ST_StartPoint,ST_EndPoint&#x5206;&#x522B;&#x8FD4;&#x56DE;LineString&#x6216;CircularLineString&#x7684;&#x8D77;&#x70B9;&#xFF0C;&#x7EC8;&#x70B9;&#xFF0C;<strong>&#x5165;&#x53C2;&#x5FC5;&#x987B;&#x662F;LineString&#x4E0E;CircularLineString&#xFF0C;&#x5982;&#x679C;&#x662F;&#x5176;&#x4ED6;&#x56FE;&#x5F62;&#x7C7B;&#x578B;&#xFF0C;&#x8FD4;&#x56DE;null</strong>&#x3002;</p>
<pre class="language-"><code>SELECT ST_AsText(ST_StartPoint(geom)) startpt, ST_AsText(ST_EndPoint(geom)) endpt
FROM (SELECT ST_GeomFromEWKT(&apos;LINESTRING(0 0, 0 1, 1 0, 1 1)&apos;) AS geom) AS foo;
  startpt   |    endpt 
--------------------------
POINT(0 0)  |  POINT(1 1)


SELECT ST_EndPoint(&apos;POINT(1 1)&apos;::geometry) IS NULL AS is_null;
is_null
--------
 true
</code></pre><h3 id="stnumgeometriesstgeometryn"><span id="ST_NumGeometries">ST_NumGeometries,ST_GeometryN</span></h3>
<p>&#x4F5C;&#x7528;&#xFF1A;ST_NumGeometries&#x8FD4;&#x56DE;&#x4E00;&#x4E2A;&#x56FE;&#x5F62;&#x96C6;&#x5408;&#x4E2D;&#x5B50;&#x56FE;&#x5F62;&#x7684;&#x6570;&#x91CF;&#xFF0C;ST_GeometryN&#x8FD4;&#x56DE;&#x56FE;&#x5F62;&#x96C6;&#x5408;&#x4E2D;&#x5E8F;&#x53F7;&#x4E3A;n&#x7684;&#x5B50;&#x56FE;&#x5F62;&#x3002;&#x4E24;&#x8005;&#x5173;&#x7CFB;&#x7C7B;&#x4F3C;&#x4E0E;&#x5176;&#x4ED6;&#x8BED;&#x8A00;&#x4E2D;&#x83B7;&#x53D6;&#x6570;&#x7EC4;&#x7684;&#x957F;&#x5EA6;&#xFF0C;&#x6839;&#x636E;&#x7D22;&#x5F15;&#x8FD4;&#x56DE;&#x6570;&#x7EC4;&#x4E2D;&#x6307;&#x5B9A;&#x5B50;&#x9879;&#x3002;</p>
<p>&#x56FE;&#x5F62;&#x96C6;&#x5408;&#x7684;&#x6982;&#x5FF5;&#xFF1A;GEOMETRYCOLLECTION, (MULTI)POINT, (MULTI)LINESTRING,
MULTICURVE or (MULTI)POLYGON, POLYHEDRALSURFACE&#x3002;</p>
<p>&#x7D22;&#x5F15;&#x5E8F;&#x53F7;&#xFF1A;&#x6570;&#x636E;&#x5E93;&#x4E2D;&#x6570;&#x7EC4;&#x9996;&#x9879;&#x5E8F;&#x53F7;&#x662F;1&#x3002;&#x4E0E;&#x5176;&#x4ED6;&#x8BED;&#x8A00;&#x4E2D;&#x6570;&#x7EC4;&#x9996;&#x9879;&#x5E8F;&#x53F7;&#x4E3A;0&#x6709;&#x533A;&#x522B;&#x3002;</p>
<pre class="language-"><code>--&#x83B7;&#x53D6;&#x56FE;&#x5F62;&#x96C6;&#x5408;&#x4E2D;&#x7684;&#x5B50;&#x56FE;&#x5F62;&#x6570;&#x91CF;&#x3002;
SELECT ST_NumGeometries(ST_GeomFromEWKT(&apos;GEOMETRYCOLLECTION(
                POINT(0 0),
                LINESTRING(0 0,1 1),
                POLYGON((0 0,1 0,1 1,0 1,0 0)))&apos;));
    ST_NumGeometries
---------------------------
           3
--&#x83B7;&#x53D6;&#x56FE;&#x5F62;&#x96C6;&#x5408;&#x4E2D;&#x5E8F;&#x53F7;&#x4E3A;2&#x7684;&#x5B50;&#x56FE;&#x5F62;
SELECT ST_AsText(ST_GeometryN(ST_GeomFromEWKT(&apos;GEOMETRYCOLLECTION(
                POINT(0 0),
                LINESTRING(0 0,1 1),
                POLYGON((0 0,1 0,1 1,0 1,0 0)))&apos;),2));
    ST_GeometryN
---------------------------
  LINESTRING(0 0,1 1)


--Multi&#x7C7B;&#x578B;
SELECT ST_NumGeometries(ST_GeomFromEWKT(&apos;MultiPOINT(0 0,1 1,2 2)&apos;));
    ST_NumGeometries
---------------------------
           3
SELECT ST_AsText(ST_GeometryN(ST_GeomFromEWKT(&apos;MultiPOINT(0 0,1 1,2 2)&apos;),2));
    ST_GeometryN
---------------------------
     POINT(1 1)
</code></pre><h3 id=""> </h3>
<h3 id="stnringsstexteriorringstnuminteriorringsstnuminteriorringstinteriorringn"><span id="ST_NRings">ST_NRings,ST_ExteriorRing,ST_NumInteriorRings,ST_NumInteriorRing,ST_InteriorRingN</span></h3>
<table>
<thead>
<tr>
<th>&#x51FD;&#x6570;&#x540D;&#x79F0;</th>
<th>&#x4F5C;&#x7528;</th>
</tr>
</thead>
<tbody>
<tr>
<td>ST_NRings</td>
<td>&#x8FD4;&#x56DE;Polygon&#x7684;&#x201C;&#x73AF;&#x201D;&#x6570;&#x91CF;&#xFF0C;&#x5305;&#x62EC;&#x5916;&#x73AF;&#x548C;&#x5185;&#x73AF;</td>
</tr>
<tr>
<td>ST_NumInteriorRings</td>
<td>&#x8FD4;&#x56DE;Polygon&#x7684;&#x201C;&#x5185;&#x73AF;&#x201D;&#x6570;&#x91CF;</td>
</tr>
<tr>
<td>ST_NumInteriorRing</td>
<td>&#x4E0E;ST_NumInteriorRings&#x4E00;&#x6A21;&#x4E00;&#x6837;</td>
</tr>
<tr>
<td>ST_ExteriorRing</td>
<td>&#x83B7;&#x53D6;Polygon&#x7684;&#x5916;&#x73AF;(Polygon&#x53EA;&#x6709;&#x4E00;&#x4E2A;&#x5916;&#x73AF;)</td>
</tr>
<tr>
<td>ST_InteriorRingN</td>
<td>&#x83B7;&#x53D6;Polygon&#x7684;&#x6307;&#x5B9A;&#x5E8F;&#x53F7;&#x7684;&#x5185;&#x73AF;(Polygon&#x53EF;&#x4EE5;&#x6709;&#x591A;&#x4E2A;&#x5185;&#x73AF;)</td>
</tr>
</tbody>
</table>
<p><img src="http://localhost:4000/images/Accessors/ST_NumInteriorRings1.png" alt=""></p>
<p>&#x6240;&#x8C13;&#x201C;&#x5185;&#x73AF;&#x201D;&#x5C31;&#x662F;&#x9762;&#x5185;&#x7EC4;&#x6210;&#x5B54;&#x6D1E;&#x7684;&#x95ED;&#x5408;&#x7EBF;&#xFF08;&#x5B54;&#x6D1E;&#x8FB9;&#x754C;&#x7EBF;&#xFF09;&#x3002;</p>
<p><strong>&#x9650;&#x5236;&#x8BF4;&#x660E;&#xFF1A;&#x4E0D;&#x7528;&#x591A;&#x60F3;&#xFF0C;&#x53EA;&#x8981;&#x8BB0;&#x4F4F;&#x8FD9;&#x4E9B;&#x51FD;&#x6570;&#x4EC5;&#x652F;&#x6301;Polygon&#x7C7B;&#x578B;&#x3002;</strong></p>
<p>--&#x65E0;&#x5B54;&#x6D1E;</p>
<pre class="language-"><code>--&#x8BE5;&#x9762;&#x5C31;&#x53EA;&#x6709;1&#x4E2A;&#x5916;&#x73AF;&#xFF0C;&#x5185;&#x73AF;&#x6570;&#x91CF;0
SELECT ST_NRings(geom),ST_NumInteriorRings(geom) from (SELECT ST_GeomFromEWKT(&apos;Polygon((0 0,1 0,1 1,0 1,0 0))&apos;) AS geom) AS foo;
ST_NRings   |    ST_NumInteriorRings
--------------------------------------
    1       |            0
</code></pre><p>--&#x6709;&#x5B54;&#x6D1E;
<img src="http://localhost:4000/images/Accessors/ST_NumInteriorRings.png" alt=""></p>
<pre class="language-"><code>--&#x8FD4;&#x56DE;&#x5B54;&#x6D1E;&#x6570;&#x91CF;
SELECT ST_NRings(geom),ST_NumInteriorRings(geom) from (SELECT ST_GeomFromEWKT(&apos;Polygon((0 0,3 0,3 3,0 3,0 0),(1 1,1 2,2 2,2 1,1 1))&apos;) AS geom) AS foo;
ST_NRings   |    ST_NumInteriorRings
--------------------------------------
    2       |            1

--&#x83B7;&#x53D6;&#x5916;&#x73AF;&#x7684;&#x56FE;&#x5F62;
SELECT ST_AsText(ST_ExteriorRing(ST_GeomFromEWKT(&apos;Polygon((0 0,3 0,3 3,0 3,0 0),(1 1,1 2,2 2,2 1,1 1))&apos;)));
         ST_AsText
-------------------------------
LINESTRING(0 0,3 0,3 3,0 3,0 0)


--&#x83B7;&#x53D6;&#x7B2C;&#x4E00;&#x4E2A;&#x5B54;&#x6D1E;&#x7684;&#x56FE;&#x5F62;
SELECT ST_AsText(ST_InteriorRingN(ST_GeomFromEWKT(&apos;Polygon((0 0,3 0,3 3,0 3,0 0),(1 1,1 2,2 2,2 1,1 1))&apos;),1));
         ST_AsText
-------------------------------
LINESTRING(1 1,1 2,2 2,2 1,1 1)
</code></pre><p>ST_NRings&#x662F;&#x652F;&#x6301;MultiPolygon&#x7684;&#xFF1A;</p>
<pre class="language-"><code>SELECT ST_NRings(ST_GeomFromEWKT(&apos;MultiPolygon(((0 0,3 0,3 3,0 3,0 0),(1 1,1 2,2 2,2 1,1 1)))&apos;));
 ST_NRings
------------
    2
</code></pre><p>PostGIS&#x5B98;&#x7F51;&#x8BF4;ST_NumInteriorRings&#x652F;&#x6301;MultiPolygon&#xFF0C;&#x8FD4;&#x56DE;MultiPolygon&#x7684;&#x7B2C;&#x4E00;&#x4E2A;Polygon&#x4E2D;&#x7684;&#x5185;&#x73AF;&#x6570;&#x91CF;&#xFF0C;&#x4F46;&#x5B9E;&#x6D4B;&#x53D1;&#x73B0;&#x5B98;&#x7F51;&#x662F;&#x9519;&#x8BEF;&#x7684;&#xFF0C;ST_NumInteriorRings&#x5BF9;MultiPolygon&#x8FD4;&#x56DE;&#x4E86;null&#xFF1A;</p>
<pre class="language-"><code>SELECT ST_NumInteriorRings(ST_GeomFromEWKT(&apos;MultiPolygon(((0 0,3 0,3 3,0 3,0 0),(1 1,1 2,2 2,2 1,1 1)))&apos;));
ST_NumInteriorRings
--------------------
    null
</code></pre><p><strong>&#x7ED3;&#x8BBA;&#xFF1A;&#x9664;ST_NRings&#x652F;&#x6301;MultiPolygon&#x5916;&#xFF0C;&#x539F;&#x5219;&#x4E0A;&#x8FD9;&#x4E9B;&#x51FD;&#x6570;&#x90FD;&#x8BA4;&#x4E3A;&#x662F;&#x53EA;&#x5904;&#x7406;Polygon&#x7C7B;&#x578B;&#x6BD4;&#x8F83;&#x597D;&#xFF0C;&#x5B9E;&#x9645;&#x4E5F;&#x7684;&#x786E;&#x53EA;&#x662F;&#x7528;&#x6765;&#x5904;&#x7406;Polygon&#x7684;&#x3002;</strong></p>
<h3 id="stnumpatchesstpatchn"><span id="ST_NumPatches">ST_NumPatches,ST_PatchN</span></h3>
<table>
<thead>
<tr>
<th>&#x51FD;&#x6570;&#x540D;&#x79F0;</th>
<th>&#x4F5C;&#x7528;</th>
</tr>
</thead>
<tbody>
<tr>
<td>ST_NumPatches</td>
<td>&#x8FD4;&#x56DE;&#x591A;&#x9762;&#x66F2;&#x9762;&#x4E0A;&#x9762;&#x7684;&#x6570;&#x91CF;&#xFF0C;&#x5BF9;&#x975E;&#x591A;&#x9762;&#x66F2;&#x9762;&#x7C7B;&#x578B;&#x8FD4;&#x56DE;null</td>
</tr>
<tr>
<td>ST_PatchN</td>
<td>&#x8FD4;&#x56DE;&#x591A;&#x9762;&#x66F2;&#x9762;&#x4E0A;&#x6307;&#x5B9A;&#x5E8F;&#x53F7;&#x4E3A;n&#x7684;&#x66F2;&#x9762;&#xFF0C;&#x4F7F;&#x7528;ST_GeometryN&#x53EF;&#x4EE5;&#x66FF;&#x4EE3;ST_PatchN&#xFF0C;&#x7ED3;&#x679C;&#x4E00;&#x6837;&#x4E14;&#x67E5;&#x8BE2;&#x66F4;&#x5FEB;</td>
</tr>
</tbody>
</table>
<pre class="language-"><code>--&#x8FD4;&#x56DE;&#x66F2;&#x9762;&#x591A;&#x9762;&#x4E0A;&#x9762;&#x7684;&#x6570;&#x91CF;
SELECT ST_NumPatches(ST_GeomFromEWKT(&apos;POLYHEDRALSURFACE( 
    ((0 0 0, 0 0 1, 0 1 1, 0 1 0, 0 0 0)),
    ((0 0 0, 0 1 0, 1 1 0, 1 0 0, 0 0 0)),
    ((0 0 0, 1 0 0, 1 0 1, 0 0 1, 0 0 0)),
    ((1 1 0, 1 1 1, 1 0 1, 1 0 0, 1 1 0)),
    ((0 1 0, 0 1 1, 1 1 1, 1 1 0, 0 1 0)), 
    ((0 0 1, 1 0 1, 1 1 1, 0 1 1, 0 0 1)) 
)&apos;));
ST_NumPatches
------------
     6

--&#x8FD4;&#x56DE;&#x66F2;&#x9762;&#x591A;&#x9762;&#x4E0A;&#x6307;&#x5B9A;&#x5E8F;&#x53F7;&#x4E3A;n&#x7684;&#x66F2;&#x9762;
SELECT ST_AsEWKT(ST_PatchN(geom, 2)) FROM (VALUES (ST_GeomFromEWKT(&apos;POLYHEDRALSURFACE( 
    ((0 0 0, 0 0 1, 0 1 1, 0 1 0, 0 0 0)),
    ((0 0 0, 0 1 0, 1 1 0, 1 0 0, 0 0 0)), 
    ((0 0 0, 1 0 0, 1 0 1, 0 0 1, 0 0 0)),
    ((1 1 0, 1 1 1, 1 0 1, 1 0 0, 1 1 0)),
    ((0 1 0, 0 1 1, 1 1 1, 1 1 0, 0 1 0)), 
    ((0 0 1, 1 0 1, 1 1 1, 0 1 1, 0 0 1)) )&apos;
)) ) As foo(geom);
        ST_AsEWKT
-----------------------------------------
POLYGON((0 0 0,0 1 0,1 1 0,1 0 0,0 0 0))

--&#x5176;&#x5B9E;&#x4F7F;&#x7528;ST_GeometryN&#x53EF;&#x4EE5;&#x66FF;&#x4EE3;ST_PatchN&#xFF0C;&#x7ED3;&#x679C;&#x4E00;&#x6837;&#x3002;
</code></pre><h3 id="stnpointsstnumpointsstpointnstpoints"><span id="ST_NPoints">ST_NPoints,ST_NumPoints,ST_PointN,ST_Points</span></h3>
<table>
<thead>
<tr>
<th>&#x51FD;&#x6570;&#x540D;&#x79F0;</th>
<th>&#x4F5C;&#x7528;</th>
</tr>
</thead>
<tbody>
<tr>
<td>ST_NPoints</td>
<td>&#x8FD4;&#x56DE;geometry&#x4E0A;Point&#x70B9;&#x6570;&#x91CF;&#xFF0C;&#x4E0D;&#x4EC5;&#x4EC5;&#x9488;&#x5BF9;LineString&#x3002;</td>
</tr>
<tr>
<td>ST_NumPoints</td>
<td>&#x8FD4;&#x56DE;LineString&#x6216;CircularString&#x4E0A;&#x8282;&#x70B9;&#x6570;&#x91CF;&#xFF0C;&#x4E0D;&#x652F;&#x6301;Multi&#x7C7B;&#x578B;&#x3002;</td>
</tr>
<tr>
<td>ST_PointN</td>
<td>&#x8FD4;&#x56DE;LineString&#x6216;CircularString&#x6307;&#x5B9A;&#x5E8F;&#x53F7;&#x4E3A;n&#x7684;&#x70B9;&#xFF0C;n=-1&#x662F;&#x7EC8;&#x70B9;&#x3002;</td>
</tr>
<tr>
<td>ST_Points</td>
<td>&#x8FD4;&#x56DE;geometry&#x4E0A;&#x6240;&#x6709;Point&#x70B9;&#x5750;&#x6807;&#xFF0C;&#x7ED3;&#x679C;&#x4E3A;MultiPoint&#x5F62;&#x5F0F;&#x3002;</td>
</tr>
</tbody>
</table>
<pre class="language-"><code>--ST_NPoints
SELECT ST_NPoints(ST_GeomFromText(&apos;LINESTRING(1 1,2 2,3 4)&apos;));
 ST_NPoints
--------------
    3
SELECT ST_NPoints(ST_GeomFromText(&apos;Polygon((1 1,1 2,2 2,2 1,1 1))&apos;));
 ST_NPoints
--------------
    5

--ST_NumPoints
SELECT ST_NumPoints(ST_GeomFromText(&apos;LINESTRING(1 1,2 2,3 4)&apos;));
 ST_NumPoints
--------------
    3
SELECT ST_NumPoints(ST_GeomFromText(&apos;Polygon((1 1,1 2,2 2,2 1,1 1))&apos;));
 ST_NumPoints
--------------
    null

--&#x5E8F;&#x53F7;&#x4E3A;2
SELECT ST_AsText(ST_PointN(ST_GeomFromText(&apos;LINESTRING(1 1,2 2,3 4)&apos;),2));
  ST_AsText
--------------
  POINT(2 2)
--&#x5E8F;&#x53F7;&#x4E3A;0
SELECT ST_AsText(ST_PointN(ST_GeomFromText(&apos;LINESTRING(1 1,2 2,3 4)&apos;),0));
  ST_AsText
--------------
   null
 --&#x5E8F;&#x53F7;&#x4E3A;-1
SELECT ST_AsText(ST_PointN(ST_GeomFromText(&apos;LINESTRING(1 1,2 2,3 4)&apos;),-1));
  ST_AsText
--------------
  POINT(3 4)

--ST_Points
select ST_AsText(ST_Points(ST_GeomFromText(&apos;LINESTRING(1 1,2 2,3 4)&apos;)));
     ST_AsText
-----------------------
MULTIPOINT(1 1,2 2,3 4)
select ST_AsText(ST_Points(ST_GeomFromText(&apos;Polygon((1 1,1 2,2 2,2 1,1 1))&apos;)));
           ST_AsText
-------------------------------
MULTIPOINT(1 1,1 2,2 2,2 1,1 1)
</code></pre><p><strong>&#x7ED3;&#x8BBA;&#xFF1A;ST_NPoints&#x548C;ST_NumPoints&#x76F8;&#x540C;&#x70B9;&#x662F;&#x90FD;&#x83B7;&#x53D6;&#x56FE;&#x5F62;&#x7684;Point&#x70B9;&#x6570;&#x91CF;&#xFF1B;&#x4E0D;&#x540C;&#x70B9;&#x662F;ST_NumPoints&#x4EC5;&#x4EC5;&#x9488;&#x5BF9;LineString&#x6216;CircularString&#xFF0C;&#x800C;ST_NPoints&#x8FD8;&#x652F;&#x6301;&#x66F4;&#x591A;&#x5176;&#x4ED6;&#x7C7B;&#x578B;&#x7684;&#x56FE;&#x5F62;&#x3002;</strong></p>
<h3 id="stmemsize"><span id="ST_MemSize">ST_MemSize</span></h3>
<p>&#x4F5C;&#x7528;&#xFF1A;&#x8FD4;&#x56DE;&#x4E00;&#x4E2A;geom&#x5360;&#x7528;&#x5185;&#x5B58;&#x7A7A;&#x95F4;&#x5927;&#x5C0F;&#x3002;</p>
<p>&#x8BF4;&#x660E;&#xFF1A;ST_MemSize&#x662F;PostgreSQL&#x539F;&#x751F;&#x7684;pg_column_size, pg_size_pretty, pg_relation_size, pg_total_relatio_size&#x7B49;&#x83B7;&#x53D6;&#x8868;&#x6216;&#x5B57;&#x6BB5;&#x7269;&#x7406;&#x5927;&#x5C0F;&#x5B57;&#x6BB5;&#x7684;&#x8865;&#x5145;&#xFF0C;&#x539F;&#x56E0;&#x662F;&#x539F;&#x751F;&#x51FD;&#x6570;&#x4E0D;&#x80FD;&#x51C6;&#x786E;&#x8868;&#x8FBE;geom&#x7684;&#x5927;&#x5C0F;&#x3002;</p>
<p>&#x4E3A;&#x4EC0;&#x4E48;&#x4E0D;&#x4F7F;&#x7528;&#x539F;&#x751F;&#x7684;pg&#x51FD;&#x6570;&#x53BB;&#x83B7;&#x53D6;geometry&#x6216;geom&#x5217;&#x6216;&#x7A7A;&#x95F4;&#x8868;&#x7684;&#x7269;&#x7406;&#x5927;&#x5C0F;&#xFF1F;&#x7531;&#x4E8E;geometry&#x662F;&#x4E2A;&#x5927;&#x5BF9;&#x8C61;&#xFF0C;PG&#x4E2D;&#x5BF9;&#x4E8E;&#x5927;&#x5BF9;&#x8C61;&#x7684;&#x7269;&#x7406;&#x5B58;&#x50A8;&#x63D0;&#x4F9B;&#x4E86;TOAST&#x529F;&#x80FD;&#xFF0C;&#x53EA;&#x6709;&#x4E86;&#x89E3;TOAST&#x7684;&#x56DB;&#x79CD;&#x5B58;&#x50A8;&#x7B56;&#x7565;&#xFF0C;&#x624D;&#x80FD;&#x7406;&#x89E3;&#x4E3A;&#x4EC0;&#x4E48;&#x539F;&#x751F;&#x51FD;&#x6570;&#x4E0D;&#x9002;&#x5408;&#xFF0C;&#x800C;&#x8981;&#x5F15;&#x5165;ST_MemSize&#xFF0C;&#x5173;&#x4E8E;TOAS&#x4E0E;PostGIS&#x66F4;&#x591A;&#x77E5;&#x8BC6;&#xFF0C;&#x8BF7;&#x67E5;&#x770B;&#xFF1A;<strong>&#x5F85;&#x8865;&#x5145;</strong>&#x3002;</p>
<pre class="language-"><code>--&#x5355;&#x4F4D;&#x662F;bytes&#xFF0C;&#x5982;&#x679C;&#x5BF9;&#x8C61;&#x7279;&#x522B;&#x5927;&#xFF0C;&#x53EF;&#x4EE5;&#x7528;pg_size_pretty&#x51FD;&#x6570;&#x663E;&#x793A;&#x7684;&#x66F4;&#x4EBA;&#x6027;&#x5316;
--pg_size_pretty&#x53EF;&#x4EE5;&#x6839;&#x636E;&#x5B9E;&#x9645;&#x5927;&#x5C0F;&#x8FD4;&#x56DE;MB&#xFF0C;GB&#x7B49;&#x5355;&#x4F4D;&#x3002;
select ST_MemSize(ST_GeomFromText(&apos;LINESTRING(1 1,2 2,3 4)&apos;));
ST_MemSize
----------
    80
</code></pre><h3 id="stsummary"><span id="ST_Summary">ST_Summary</span></h3>
<p>&#x4F5C;&#x7528;&#xFF1A;&#x4EE5;&#x4E00;&#x4E2A;&#x6807;&#x51C6;&#x5316;&#x7684;&#x5B57;&#x7B26;&#x4E32;&#x63CF;&#x8FF0;&#x4E00;&#x4E2A;&#x56FE;&#x5F62;&#x7684;&#x6982;&#x8981;&#x4FE1;&#x606F;&#x3002;</p>
<p>&#x5173;&#x952E;&#x5B57;&#xFF1A;</p>
<ul>
<li>M: &#x56FE;&#x5F62;&#x5750;&#x6807;&#x542B;&#x6709;M&#x503C;</li>
<li>Z: &#x56FE;&#x5F62;&#x5750;&#x6807;&#x542B;&#x6709;Z&#x503C;</li>
<li>B: &#x6709;&#x7F13;&#x5B58;bbox</li>
<li>G: &#x56FE;&#x5F62;&#x4E3A;&#x5927;&#x5730;&#x5750;&#x6807; (geography)</li>
<li>S: &#x56FE;&#x5F62;&#x6709;&#x7A7A;&#x95F4;&#x5750;&#x6807;&#x7CFB;</li>
</ul>
<pre class="language-"><code>SELECT ST_Summary(ST_GeomFromText(&apos;LINESTRING(0 0, 1 1)&apos;)) as geom1,
ST_Summary(ST_GeomFromText(&apos;LINESTRINGM(0 0 0, 1 1 1)&apos;)) as geom2;
           geom1           |            geom2
--------------------------------------------------------
LineString[] with 2 points | LineString[M] with 2 points

select ST_Summary(ST_GeomFromText(&apos;LINESTRINGZ(0 0 0, 1 1 1)&apos;)) as geom3,ST_Summary(ST_GeomFromText(&apos;LINESTRING(0 0, 1 1)&apos;,4326)) as geom4;
           geom3            |            geom4
--------------------------------------------------------
LineString[Z] with 2 points | LineString[S] with 2 points

select ST_Summary(ST_GeogFromText(&apos;POLYGON((0 0, 1 1, 1 2, 1 1, 0 0))&apos;)) geog;
              geog
--------------------------------
    Polygon[BGS] with 1 ring:
    ring 0 has 5 points
</code></pre><p><strong>&#x6CE8;&#x610F;&#xFF1A;pg&#x4E2D;&#x6570;&#x7EC4;&#x90FD;&#x662F;&#x4ECE;1&#x5F00;&#x59CB;&#x8BA1;&#x6570;&#x7684;&#xFF0C;&#x5728;ST_InteriorRingN&#x4E2D;n=1&#x5C31;&#x662F;&#x7B2C;&#x4E00;&#x4E2A;&#x5916;&#x73AF;&#x3002;&#x4F46;&#x662F;&#x5728;ST_Summary&#x8FD4;&#x56DE;&#x7684;&#x6587;&#x672C;&#x4E32;&#x91CC;&#xFF0C;&#x7B2C;&#x4E00;&#x4E2A;ring&#x5E8F;&#x53F7;&#x4ECE;0&#x5F00;&#x59CB;&#x3002;</strong></p>
<h3 id="stdumpstdumppointsstdumprings"><span id="ST_Dump">ST_Dump,ST_DumpPoints,ST_DumpRings</span></h3>
<p>&#x8FD9;&#x4E09;&#x4E2A;&#x51FD;&#x6570;&#x8FD4;&#x56DE;&#x503C;&#x90FD;&#x662F;geometry_dump&#x7C7B;&#x578B;&#xFF08;<strong>&#x7F3A;&#x5C11;&#x7C7B;&#x578B;&#x63CF;&#x8FF0;</strong>&#xFF09;&#x7684;&#x6570;&#x636E;&#x96C6;&#x3002;
&#x51FD;&#x6570;&#x540D;&#x79F0; | &#x4F5C;&#x7528;
---|---
ST_Dump | &#x5206;&#x89E3;&#x590D;&#x6742;&#x7EC4;&#x5408;&#x56FE;&#x5F62;
ST_DumpRings | &#x5C06;Polygon&#x5206;&#x89E3;&#x6210;&#x82E5;&#x5E72;ring&#xFF08;&#x73AF;&#xFF09;
ST_DumpPoints | &#x5C06;&#x56FE;&#x5F62;&#x5206;&#x89E3;&#x6210;&#x70B9;
ST_Dump&#x793A;&#x4F8B;&#xFF1A;</p>
<pre class="language-"><code>--&#x62C6;&#x5206;&#x96C6;&#x5408;
 select (a.infos).path,st_astext((a.infos).geom) from 
(SELECT (ST_Dump(p_geom)) AS infos FROM (
    SELECT ST_GeomFromEWKT(&apos;GEOMETRYCOLLECTION(LineString(0 0, 1 1, 1 0),LineString(1 0, 0 1))&apos;) AS p_geom) 
AS b) as a;

path   |          geom
-----------------------------------
{1}    | LINESTRING(0 0,1 1,1 0)
{2}    | LINESTRING(1 0,0 1)

--&#x62C6;&#x5206;&#x591A;&#x4E49;&#x7EBF;
select (a.infos).path,st_astext((a.infos).geom) from 
(SELECT (ST_Dump(p_geom)) AS infos FROM (
    SELECT ST_GeomFromEWKT(&apos;MultiLineString((0 0, 1 1, 1 0),(1 0, 0 1))&apos;) AS p_geom) 
AS b) as a;
path   |         geom
--------------------------------
{1}    | LINESTRING(0 0,1 1,1 0)
{2}    | LINESTRING(1 0,0 1)


--&#x62C6;&#x5206;&#x591A;&#x4E49;&#x9762;
select (a.infos).path,st_astext((a.infos).geom) from 
(SELECT (ST_Dump(p_geom)) AS infos
FROM (SELECT ST_GeomFromEWKT(&apos;MultiPolygon(((0 0,3 0,3 3,0 3,0 0)),((1 1,1 2,2 2,2 1,1 1)))&apos;) AS p_geom) AS b)
as a;
path   |           geom
---------------------------------------
{1}    | POLYGON((0 0,3 0,3 3,0 3,0 0))
{2}    | POLYGON((1 1,1 2,2 2,2 1,1 1))
</code></pre><p>ST_DumpRings&#x793A;&#x4F8B;&#xFF1A;</p>
<pre class="language-"><code>select (a.infos).path,st_astext((a.infos).geom) from 
(SELECT (ST_DumpRings(p_geom)) AS infos
FROM (SELECT ST_GeomFromEWKT(&apos;Polygon((0 0,3 0,3 3,0 3,0 0),(1 1,1 2,2 2,2 1,1 1))&apos;) AS p_geom) AS b)
as a;
path   |           geom
---------------------------------------
{1}    | POLYGON((0 0,3 0,3 3,0 3,0 0))
{2}    | POLYGON((1 1,1 2,2 2,2 1,1 1))
</code></pre><p>ST_DumpPoints&#x5206;&#x89E3;&#x6210;&#x70B9;&#x7684;&#x65F6;&#x5019;&#xFF0C;path&#x6570;&#x7EC4;&#x6BD4;&#x8F83;&#x7279;&#x6B8A;&#xFF0C;&#x4F8B;&#x5982;MultiPolygon&#x62C6;&#x5206;&#x70B9;&#x540E;&#xFF0C;path&#x683C;&#x5F0F;&#x662F;{polygon_idx,ring_idx,pt_idx}&#xFF0C;&#x5206;&#x522B;&#x8868;&#x8FBE;&#x76EE;&#x524D;&#x8FD9;&#x4E2A;&#x70B9;&#x5728;&#x591A;&#x4E49;&#x9762;&#x4E2D;&#x662F;&#x54EA;&#x4E2A;&#x5B50;&#x9762;&#x54EA;&#x4E2A;&#x5B50;&#x73AF;&#x54EA;&#x4E2A;&#x5B50;&#x8282;&#x70B9;&#x4E0A;&#xFF1B;&#x800C;Polygon&#x7684;path&#x683C;&#x5F0F;&#x662F;{ring_idx,pt_idx},&#x63CF;&#x8FF0;&#x8BE5;&#x70B9;&#x5728;&#x9762;&#x4E2D;&#x4F4D;&#x4E8E;&#x54EA;&#x4E2A;&#x5B50;&#x73AF;&#x7684;&#x54EA;&#x4E2A;&#x5B50;&#x8282;&#x70B9;&#xFF1B;MultiLineString&#x7684;path&#x683C;&#x5F0F;&#x662F;{line_idx,pt_idx}&#xFF0C;&#x63CF;&#x8FF0;&#x8BE5;&#x70B9;&#x5728;&#x591A;&#x4E49;&#x7EBF;&#x4E2D;&#x4F4D;&#x4E8E;&#x54EA;&#x4E2A;&#x5B50;&#x7EBF;&#x7684;&#x54EA;&#x4E2A;&#x5B50;&#x8282;&#x70B9;&#xFF1B;LineString&#x7684;path&#x683C;&#x5F0F;&#x5C31;&#x662F;{pt_idx}&#xFF0C;&#x5F88;&#x597D;&#x7406;&#x89E3;&#x3002;&#x7EFC;&#x8FF0;&#xFF1A;path&#x662F;&#x63CF;&#x8FF0;&#x8FD9;&#x4E2A;&#x70B9;&#x5728;&#x56FE;&#x5F62;&#x4E2D;&#x7684;&#x5C42;&#x7EA7;&#x5173;&#x7CFB;&#x7684;&#x3002;</p>
<pre class="language-"><code>--&#x591A;&#x4E49;&#x9762;
select (a.infos).path,st_astext((a.infos).geom) from 
(SELECT (ST_DumpPoints(p_geom)) AS infos
FROM (SELECT ST_GeomFromEWKT(&apos;MultiPolygon(((0 0,3 0,3 3,0 3,0 0),(1 1,1 2,2 2,2 1,1 1)))&apos;) AS p_geom) AS b)
as a;
path   |           geom
---------------------------------------
{1,1,1}    |      POINT(0 0)
{1,1,2}    |      POINT(3 0)
{1,1,3}    |      POINT(3 3)
{1,1,4}    |      POINT(0 3)
{1,1,5}    |      POINT(0 0)
{1,2,1}    |      POINT(1 1)
{1,2,2}    |      POINT(1 2)
{1,2,3}    |      POINT(2 2)
{1,2,4}    |      POINT(2 1)
{1,2,5}    |      POINT(1 1)

--&#x5355;&#x9762;
select (a.infos).path,st_astext((a.infos).geom) from 
(SELECT (ST_DumpPoints(p_geom)) AS infos
FROM (SELECT ST_GeomFromEWKT(&apos;Polygon((0 0,3 0,3 3,0 3,0 0),(1 1,1 2,2 2,2 1,1 1))&apos;) AS p_geom) AS b)
as a;
path   |           geom
---------------------------------------
{1,1}    |      POINT(0 0)
{1,2}    |      POINT(3 0)
{1,3}    |      POINT(3 3)
{1,4}    |      POINT(0 3)
{1,5}    |      POINT(0 0)
{2,1}    |      POINT(1 1)
{2,2}    |      POINT(1 2)
{2,3}    |      POINT(2 2)
{2,4}    |      POINT(2 1)
{2,5}    |      POINT(1 1)
</code></pre>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                
                <a href="Accessors.html#ST_GeometryType" class="navigation navigation-next navigation-unique" aria-label="Next page: ST_GeometryType">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"GeometryType","level":"2.1.2.1","depth":3,"next":{"title":"ST_GeometryType","level":"2.1.2.2","depth":3,"anchor":"#ST_GeometryType","path":"vector_function/Accessors.md","ref":"vector_function/Accessors.md#ST_GeometryType","articles":[]},"previous":{"title":"8.4 元数据读写","level":"2.1.2","depth":2,"ref":"","articles":[{"title":"GeometryType","level":"2.1.2.1","depth":3,"anchor":"#GeometryType","path":"vector_function/Accessors.md","ref":"vector_function/Accessors.md#GeometryType","articles":[]},{"title":"ST_GeometryType","level":"2.1.2.2","depth":3,"anchor":"#ST_GeometryType","path":"vector_function/Accessors.md","ref":"vector_function/Accessors.md#ST_GeometryType","articles":[]},{"title":"ST_CoordDim与ST_NDims","level":"2.1.2.3","depth":3,"anchor":"#ST_CoordDim","path":"vector_function/Accessors.md","ref":"vector_function/Accessors.md#ST_CoordDim","articles":[]},{"title":"ST_Dimension","level":"2.1.2.4","depth":3,"anchor":"#ST_Dimension","path":"vector_function/Accessors.md","ref":"vector_function/Accessors.md#ST_Dimension","articles":[]},{"title":"ST_Zmflag","level":"2.1.2.5","depth":3,"anchor":"#ST_Zmflag","path":"vector_function/Accessors.md","ref":"vector_function/Accessors.md#ST_Zmflag","articles":[]},{"title":"ST_HasArc","level":"2.1.2.6","depth":3,"anchor":"#ST_HasArc","path":"vector_function/Accessors.md","ref":"vector_function/Accessors.md#ST_HasArc","articles":[]},{"title":"ST_IsPolygonCCW","level":"2.1.2.7","depth":3,"anchor":"#ST_IsPolygonCCW","path":"vector_function/Accessors.md","ref":"vector_function/Accessors.md#ST_IsPolygonCCW","articles":[]},{"title":"ST_IsPolygonCW","level":"2.1.2.8","depth":3,"anchor":"#ST_IsPolygonCW","path":"vector_function/Accessors.md","ref":"vector_function/Accessors.md#ST_IsPolygonCW","articles":[]},{"title":"ST_IsClosed","level":"2.1.2.9","depth":3,"anchor":"#ST_IsClosed","path":"vector_function/Accessors.md","ref":"vector_function/Accessors.md#ST_IsClosed","articles":[]},{"title":"ST_IsCollection","level":"2.1.2.10","depth":3,"anchor":"#ST_IsCollection","path":"vector_function/Accessors.md","ref":"vector_function/Accessors.md#ST_IsCollection","articles":[]},{"title":"ST_IsEmpty","level":"2.1.2.11","depth":3,"anchor":"#ST_IsEmpty","path":"vector_function/Accessors.md","ref":"vector_function/Accessors.md#ST_IsEmpty","articles":[]},{"title":"ST_IsRing","level":"2.1.2.12","depth":3,"anchor":"#ST_IsRing","path":"vector_function/Accessors.md","ref":"vector_function/Accessors.md#ST_IsRing","articles":[]},{"title":"ST_IsSimple","level":"2.1.2.13","depth":3,"anchor":"#ST_IsSimple","path":"vector_function/Accessors.md","ref":"vector_function/Accessors.md#ST_IsSimple","articles":[]},{"title":"ST_Boundary","level":"2.1.2.14","depth":3,"anchor":"#ST_Boundary","path":"vector_function/Accessors.md","ref":"vector_function/Accessors.md#ST_Boundary","articles":[]},{"title":"ST_Envelope","level":"2.1.2.15","depth":3,"anchor":"#ST_Envelope","path":"vector_function/Accessors.md","ref":"vector_function/Accessors.md#ST_Envelope","articles":[]},{"title":"ST_BoundingDiagonal","level":"2.1.2.16","depth":3,"anchor":"#ST_BoundingDiagonal","path":"vector_function/Accessors.md","ref":"vector_function/Accessors.md#ST_BoundingDiagonal","articles":[]},{"title":"ST_X,ST_Y,ST_Z,ST_M","level":"2.1.2.17","depth":3,"anchor":"#ST_X","path":"vector_function/Accessors.md","ref":"vector_function/Accessors.md#ST_X","articles":[]},{"title":"ST_StartPoint,ST_EndPoint","level":"2.1.2.18","depth":3,"anchor":"#ST_StartPoint","path":"vector_function/Accessors.md","ref":"vector_function/Accessors.md#ST_StartPoint","articles":[]},{"title":"ST_NumGeometries,ST_GeometryN","level":"2.1.2.19","depth":3,"anchor":"#ST_NumGeometries","path":"vector_function/Accessors.md","ref":"vector_function/Accessors.md#ST_NumGeometries","articles":[]},{"title":"ST_NRings,ST_ExteriorRing,ST_NumInteriorRings,ST_NumInteriorRing,ST_InteriorRingN","level":"2.1.2.20","depth":3,"anchor":"#ST_NRings","path":"vector_function/Accessors.md","ref":"vector_function/Accessors.md#ST_NRings","articles":[]},{"title":"ST_NumPatches,ST_PatchN","level":"2.1.2.21","depth":3,"anchor":"#ST_NumPatches","path":"vector_function/Accessors.md","ref":"vector_function/Accessors.md#ST_NumPatches","articles":[]},{"title":"ST_NPoints,ST_NumPoints,ST_PointN,ST_Points","level":"2.1.2.22","depth":3,"anchor":"#ST_NPoints","path":"vector_function/Accessors.md","ref":"vector_function/Accessors.md#ST_NPoints","articles":[]},{"title":"ST_MemSize","level":"2.1.2.23","depth":3,"anchor":"#ST_MemSize","path":"vector_function/Accessors.md","ref":"vector_function/Accessors.md#ST_MemSize","articles":[]},{"title":"ST_Summary","level":"2.1.2.24","depth":3,"anchor":"#ST_Summary","path":"vector_function/Accessors.md","ref":"vector_function/Accessors.md#ST_Summary","articles":[]},{"title":"ST_Dump,ST_DumpPoints,ST_DumpRings","level":"2.1.2.25","depth":3,"anchor":"#ST_Dump","path":"vector_function/Accessors.md","ref":"vector_function/Accessors.md#ST_Dump","articles":[]}]},"dir":"ltr"},"config":{"plugins":["pageview-count","prism","-highlight","custom-favicon","-sharing","emphasize","-lunr","-search","search-pro","graph","splitter","hide-element","folding-chapters"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{"css":["prismjs/themes/prism-okaidia.css"]},"emphasize":{},"splitter":{},"search-pro":{},"graph":{},"hide-element":{"elements":[".gitbook-link"]},"fontsettings":{"theme":"white","family":"sans","size":2},"folding-chapters":{},"favicon":"../gitbook/images/favicon.ico","pageview-count":{},"custom-favicon":{},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"xxx","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{"service":"http://localhost:4000"},"title":"PostGIS中文指南","gitbook":"*","description":"记录PostGIS使用入门，进阶，提高，附带API全解析"},"file":{"path":"vector_function/Accessors.md","mtime":"2024-07-23T08:43:00.293Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2024-07-23T09:36:52.257Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-pageview-count/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-hide-element/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-folding-chapters/folding-chapters.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

